truncate string | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

truncate string

What is better performance ? select * from table1 where field1 = ”
or
select * from table1 where len(field1) = 0
if using rtrim() ? www.macul.eti.br www.macul.hpg.com.br www.primeiramao.com.br
(ad free)

Any use of function on column wont make use of index if it is defined
Other than that both will work fine
Set the execution plan and compare the timings Madhivanan Failing to plan is Planning to fail
quote:Originally posted by MACUL What is better performance ? select * from table1 where field1 = ”
or
select * from table1 where len(field1) = 0
if using rtrim() ? www.macul.eti.br www.macul.hpg.com.br www.primeiramao.com.br
(ad free)

If field1 is indexed select * from table1 where field1 = ” will use INDEX SEEK
&
select * from table1 where len(field1) = 0 will use INDEX SCAN Choice is yours. Rest as Madhivanan mentioned, compare both execution plan.
________________________________________________
Be great in act, as you have been in thought.
I can say both are good at performance wiht smaller volumes, provided you have better indexes, as suggested Execution plan is first hand help for any further betterment. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.
quote:Originally posted by satya I can say both are good at performance wiht smaller volumes, provided you have better indexes, as suggested Execution plan is first hand help for any further betterment. Satya SKJ
Microsoft SQL Server MVP
Writer, Contributing Editor & Moderator
http://www.SQL-Server-Performance.Com
This posting is provided AS IS with no rights for the sake of knowledge sharing. Knowledge is of two kinds. We know a subject ourselves or we know where we can find information on it.
MACUL,
Note Satya advise with smaller volumes, bigger volume and you will have problem as i mentioned. ________________________________________________
Be great in act, as you have been in thought.
]]>