Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
declare @Departement_Name varchar(100)
execute SP_GETDepartementByName <big>N'mike'</big>,
@Departement = @Departement_Name output
select @Departement_Name


what are the diffrence between adding it and removing it

What I have tried:

just removing it
SQL
<pre>declare @Departement_Name varchar(100)
execute SP_GETDepartementByName <big>N'mike'</big>,
@Departement = @Departement_Name output
select @Departement_Name
Posted
Updated 29-Aug-19 1:58am
v2

It's declaring the string as nvarchar data type, rather than varchar.
Source: sql server - What is the meaning of the prefix N in T-SQL statements? - Stack Overflow[^]
 
Share this answer
 
Comments
Maciej Los 29-Aug-19 7:59am    
5ed!
It means the value is a unicode string.
 
Share this answer
 
v2
Comments
Maciej Los 29-Aug-19 7:59am    
5ed!
N is a prefix. It identifies/declares NVARCHAR data type instead of VARCHAR. N prefix tells sql server to treat the string as a unicode value


For further details, please see:
nchar and nvarchar (Transact-SQL) - SQL Server | Microsoft Docs[^]
char and varchar (Transact-SQL) - SQL Server | Microsoft Docs[^]
 
Share this answer
 
v2
Comments
jimmson 29-Aug-19 8:00am    
5!
Maciej Los 29-Aug-19 8:05am    
Thank you.
N'a string' means that 'a string' is Unicode, and should be stored in an NVARCHAR column, rather than a VARCHAR. Without the N, it reverts to the older, smaller ASCII VARCHAR.

In general, despite needing more space you should be using NVARCHAR to match modern applications and frameworks such as .NET
 
Share this answer
 
Comments
Maciej Los 29-Aug-19 7:59am    
5ed!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900