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 |
MelissaTsalicoglou
Starting Member
16 Posts |
Posted - 2014-06-04 : 14:12:55
|
Please can you assist?What does the N refer to ? SUBSTRING(contactname, 0, CHARINDEX(N',', contactname)) as lastname |
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-06-04 : 14:19:56
|
It is for unicode purposes. If contactname isn't using unicode data type, then it is not needed.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
MelissaTsalicoglou
Starting Member
16 Posts |
Posted - 2014-06-04 : 14:23:07
|
thanks very muchtherefore the code takes from the first letter up until the comma as the last name? quote: Originally posted by tkizer It is for unicode purposes. If contactname isn't using unicode data type, then it is not needed.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/
|
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2014-06-04 : 14:42:06
|
quote: Originally posted by MelissaTsalicoglou thanks very muchtherefore the code takes from the first letter up until the comma as the last name?
Yes, typically you'll see 1 instead of 0 for the second parameter for SUBSTRING. CHARINDEX finds the position of the comma.Tara KizerSQL Server MVP since 2007http://weblogs.sqlteam.com/tarad/ |
|
|
|
|
|