I have a SQL Server query from third party like:
SELECT * FROM SC.TOY T WHERE T.IS_SMALL != N'Y' AND T.NAME = 'TRUCK'
I am confused about usage of apostrophe after N and Y. Can someone please help me explaining what does it exactly means?
I have a SQL Server query from third party like:
SELECT * FROM SC.TOY T WHERE T.IS_SMALL != N'Y' AND T.NAME = 'TRUCK'
I am confused about usage of apostrophe after N and Y. Can someone please help me explaining what does it exactly means?
It means that the 'Y' is stored in a table either as either ntext, nchar, nvarchar
SQL Server has char and varchar as types where each character is represented by one byte. Unicode types are nchar and nvarchar (as in native char or national language character set) where charactes are represented by two bytes per character. If one has to assign or give some literal text it is necessary to indicate which type of text it is. So
'Hello' is a char literal
N'Hello' is a nchar literal