Question regarding SQL Query Editor

dsoderstrom
dsoderstrom used Ask the Experts™
on
I am designing a query using the Query Editor in SQL server.
I am querying a table and putting a filter on a nvarchar column.
If I type a value into the filter column, for example '12', the editor changes it to N'12'.  
why is it doing this?  What does the "N" signify?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Jim HornSQL Server Data Dude
Most Valuable Expert 2013
Author of the Year 2015

Commented:
N (nchar, nvarchar, ntext) signifies Unicode, meaning it handles a larger number of characters then non-unicode, and each character takes two bytes in memory instead of one.

Typically this is needed when dealing with foreign language collations.

>If I type a value into the filter column, for example '12', the editor changes it to N'12'.  
Curiosity overwhelms me ... if you have a column that you'd want to filter on '12', then why is it a character data type as opposed to numeric?

Author

Commented:
So, can I strip out this N and get the same results?
SQL Server Data Dude
Most Valuable Expert 2013
Author of the Year 2015
Commented:
I believe it is the correct format when using an expression with a unicode (nchar, nvarchar) column.

Author

Commented:
Okay, thanks for the info Jim

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial