Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
EXECUTE COMMAND PROBLEM
Message
From
16/01/2001 06:18:37
 
 
To
15/01/2001 18:05:59
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00463985
Message ID:
00464130
Views:
19
Hi!

Use convert() function to convert to nvarchar type from UNIQUEIDENTIFIER type.

>I wrote the following code and cannot get it to run:
>
>DECLARE @RequestID UNIQUEIDENTIFIER,
> @TempTableName VARCHAR(36),
> @Cmd NVARCHAR(200)
>
>SET @RequestID = NEWID()
>SET @CMD = N'SELECT [TypeIDField], [DataValue] FROM RequestProperty_tbl re LEFT OUTER JOIN ' + @TempTableName + ' AS t ' + 'ON t.[ID] = re.[TypeIDField] WHERE re.[RequestID] = ' + @RequestID
>
>EXECUTE SP_EXECUTESQL @CMD
>
>--Server: Msg 403, Level 16, State 1, Line 7
>--Invalid operator for data type. Operator equals add, type equals nvarchar.
>
>
>How can I format it with the @RequestID UniqueIdentifier to run correctly?
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.com
ICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs

It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform