We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ErikEJ/SqlServer.Rules'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
SRP0009.md•1.01 KiB
# SQL Server Rule: SRP0009
| | |
|----|----|
| Assembly | SqlServer.Rules |
| Namespace | SqlServer.Rules.Performance |
| Class | AvoidColumnFunctionsRule |
## Rule Information
| | |
|----|----|
| Id | SRP0009 |
| Friendly Name | Filtering on calculated value |
| Category | Performance |
| Ignorable | true |
| Applicable Types | Procedure |
| | Scalar Function |
| | Table Valued Function |
| | View |
## Description
Avoid wrapping columns within a function in the WHERE clause. (Sargable)
## Summary
Avoid wrapping columns within a function in the WHERE clause. This affects sargability.
### Examples
```sql
CREATE PROCEDURE dbo.UpperFunction
AS
SET NOCOUNT ON;
SELECT user_name
FROM dbo.MyTable
WHERE UPPER(first_name) = 'NATHAN';
-- SRP0009
```
### Remarks
When a WHERE clause column is wrapped inside a function, the query optimizer does not see
the column and if an index exists on the column, the index will not to be used.
<sub><sup>Generated by a tool</sup></sub>