Assuming we have a players table with a kazillion records with PK and clustered index on playerid (BIGINT) and nonclustered index on column name (VARCHAR(50)). These two columns are the only columns on the table. Lets also assume an application was designed to pass in N'VARCHAR datatype as parameter
Would this be SARGable and if not, how would we fix it:
SELECT * FROM players WHERE name = N'richard sherman'
From my understanding I know the following would be nonSARGable:
SELECT * FROM players WHERE CONVERT(NVARCHAR(50), name) = N'richard sherman'
So to fix this, would we do this?:
WHERE name = CONVERT(VARCHAR(50), N'richard sherman')