I’d like to convert a datetime to nvarchar(64). The following code is a snippet used as part of a series of stored procedure parameters. I’ve included the area that has the error.
Incorrect syntax near KEYWORD ‘CONVERT’
exec mysproc...@Password=N'',@IsAuthorized=1,
@UTCTIMESTAMP=CONVERT(NVARCHAR(64), GETUTCDATE(), 121),
@UserId=@SingleId output
Any ideas what is wrong with this syntax?
You need to perform calculations like this prior to calling the stored procedure, you can’t do that within the process of passing values to parameters. For example:
This isn’t restricted to function calls; you also can’t do things like:
Result: