January 23, 2007 at 8:35 am
patindex vs charindex
Hello i couldnt find information which is better in perfomance , only i saw the diference, one permits to use wildcard and the other not, thats all i found but i couldnt find informations about the perfomance, i need to use someone in a trigger, which is recommendably to use??
January 23, 2007 at 3:06 pm
I would say that if the functionality is sufficient, then use the charindex.
If you do:
DECLARE @sum FLOAT, @s-2 VARCHAR(255)
SELECT @s-2 = 'foobar', @sum = 0.0
WHILE @sum < 1000000 BEGIN
SELECT @sum = @sum + CHARINDEX('o', @s-2)
END
SELECT @sum
and
DECLARE @sum FLOAT, @s-2 VARCHAR(255)
SELECT @s-2 = 'foobar', @sum = 0.0
WHILE @sum < 1000000 BEGIN
SELECT @sum = @sum + PATINDEX('%o%', @s-2)
END
SELECT @sum
there is no real performance difference.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply