While comparing two varchars MSSQL Server strips off trailing spaces.
Why is that ? Surely 'Hello' <> 'Hello '. Other whitespace characters, like TAB, don't seem to do this.
One option I found was to do a
SET ANSI_PADDING ON
But this does not seem to work for comparisons :-(.
Fianlly got the comparison to work by using the following line:
WHERE CONVERT(varbinary,field)=CONVERT(varbinary,@compare_value)
With grateful thanks to Joel On Software. Refer link : http://discuss.joelonsoftware.com/default.asp?joel.3.66884.22
Wednesday, February 20, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment