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.
| Author |
Topic |
|
bogey
Posting Yak Master
166 Posts |
Posted - 2007-04-06 : 14:03:42
|
| USE [TEST]SELECT [last_name] FROM users.[UOP_User]WHERE last_name LIKE N'B%'Whats the purpose of the N after the like?thanks |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-04-06 : 14:08:38
|
| It is for unicode data, such as nvarchar data type. If you aren't using unicode data types, then you don't need it.Tara Kizerhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
bogey
Posting Yak Master
166 Posts |
Posted - 2007-04-06 : 16:19:01
|
quote: Originally posted by tkizer It is for unicode data, such as nvarchar data type. If you aren't using unicode data types, then you don't need it.Tara Kizerhttp://weblogs.sqlteam.com/tarad/
I could not find this in the sql books online? |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2007-04-06 : 16:20:15
|
I found it in my head. Tara Kizerhttp://weblogs.sqlteam.com/tarad/ |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
pootle_flump
1064 Posts |
Posted - 2007-04-07 : 16:30:18
|
| The N explicitly converts the the text to unicode which is slightly more efficient than the engine implicitly converting it, therefore it is not mandatory. I don't know of a BoL entry that explains it in detail. The entry for NCHAR does mention it as a comment in one of the code samples. |
 |
|
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2007-04-10 : 18:07:48
|
Per BOL:Unicode constants are specified with a leading N: N'A Unicode string'. For what it is worth.. |
 |
|
|
|
|
|