Hi everybody, I have this problem I have been struggling with for more than an hour now, hoping for some help.Using SQL Server 2005.DECLARE @IPAddress nvarchar(15)SET @IPAddress = '127.0.0.1'DECLARE @UA nvarchar(300) SET @UA = 'MSIE'DECLARE @UserID int SET @UserID = 123EXEC sp_executesql N'User_LogonLog',N'@UserID int, @IPAddress nvarchar(15), @UA nvarchar(300)',@UserID,@IPAddress,@UA
It keeps given me the following error:Msg 102, Level 15, State 1, Line 1Incorrect syntax near 'User_LogonLog'.
In my head it should be perfectly valid syntax. I have also read Mr. Sommarskog's nice guide [url]http://www.sommarskog.se/dynamic_sql.html[/url], but no luck either..I have tried to remove datatypes in parameters declaration, the Unicdode N' and so... nu luck.If I run the following (without sp_executesql) there is no problem, which indicates the User_LogonLog procedure is work perfectly fine.EXEC User_LogonLog @UserID,@IPAddress,@UA
What am I missing? 