Search code examples
sqlsql-servervarcharnvarchar

How to assign nvarchar and varchar in sqlserver


I have store procedure called thisSP which calls another sp called [theOtherStoreProcedure].

[in thissp there is nvarchar EventUrl parameter.]

EXEC dbo.TheOtherStoreProcedure     @EventID = @EventID
                                    ,
                                    ,
                                    ....................
                                    ,@EventUrl = @EventUrl

in TheOtherStoreProcedure I am assigning EventUrl's and inserting it to Table.However in TheOtherStoreProcedure EventUrl is varchar

@EventUrl = @EventUrl

Question is : is SQLServer doing nvarchar to varchar convert process doing automatically?


Solution

  • SQL Server performs the implicit conversion from nvarchar to varchar provided the size of both the paramaters are compatible.

    Here is the table of conversion in SQL Server