kishore maddali

kishore maddali

  • NA
  • 3
  • 3.3k

Is not SQL 2005 not 100% percent compitable with .NET ?

Nov 29 2013 11:40 PM
Books say that trailing spaces are ignored when comparing two strings in SQL. This is true when the comparision is made from SQL editor. But from C# code this is not true and the comparion yeilded false just becaause of one trailing whitespace characteer .

Answers (2)

0
Jignesh Trivedi

Jignesh Trivedi

  • 0
  • 62.3k
  • 46m
Dec 5 2013 12:39 AM

hi,

trailing space is only ignored in sql when data type is nvarchar or varchar... because is not stored trailing white space...

declare @d varchar(50) = 'tejas   '
declare @i varchar(50) = 'tejas'

if(@d=@i)
 print 'match'
else
 print 'not match'

this is always return match....

while .NET there is string data type it always store what ever you assign...

0
rachel smith

rachel smith

  • 0
  • 2
  • 10
Dec 5 2013 12:04 AM
I've been using. NET for my website and all the versions on SQL compatible with. NET as well as SQL 2005.