Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to avoid Ltrim and Rtrim in where clause

Author  Topic 

Thiyagu_04
Starting Member

37 Posts

Posted - 2012-03-29 : 11:00:17
Hi

Please suggest me how to avoid trim functionality in where clause so that i can increase performance.

SELECT *
FROM testtable WHERE
LTRIM(RTRIM(isnull(SC,''))) = isnull(@SCAC,'')

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-03-29 : 12:10:41
why not strip spaces off in tableitself? do you really need to store that leading trainiling spaces? if not, it will be single one time update

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -