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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 what's the N for when exec SP

Author  Topic 

GrandVizier
Starting Member

14 Posts

Posted - 2007-08-13 : 22:55:45
Hej
I'm using .Net and when I was doing a Profiler Trace I noticed there was a mysterious N popping up here and there in the command

ie:
 exec sp_executesql N'UPDATE tr_Product SET 
pName = @pName, pVendorID = @pVendorID
WHERE pID=@prodID',N'@prodID nvarchar(4000),@pName nvarchar(4)
,@pID int',@prodID=NULL,@pName=N'Name'
I was just wondering what this is all about, thanks

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2007-08-13 : 22:59:28
Unicode NVARCHAR
Go to Top of Page

pk_bohra
Master Smack Fu Yak Hacker

1182 Posts

Posted - 2007-08-14 : 01:07:42
sp_executesql statement takes unicode character for execution.
By placing N before the string, we are converting it to unicode type.
Go to Top of Page
   

- Advertisement -