Click here to Skip to main content
15,746,652 members

Comments by #realJSOP (Top 200 by date)

#realJSOP 22-Jun-22 5:37am View    
I was just showing him what he did wrong and why he wasn't getting the result he was expecting. Personally, I abhor dynamic sql, and avoid it at all costs.
#realJSOP 1-Jun-22 8:03am View    
I posted the solution as a new answer.
#realJSOP 1-Jun-22 7:41am View    
If I modify the code that is string to run to the following, it works, but if sql server isn't running it that way, it's not going to do me any good.

exec sp_executesql N'dbo.UserProfileGet @UserID=@userID', N'@userID NVARCHAR(36)',@userID=N'4a39a408-4411-40a0-b916-7122946d3f65'
#realJSOP 1-Jun-22 7:19am View    
I'm not using that - that's what the profiler was showing as the command to be executed

Update - while I don't get the exception any more, it seems that the parameter is being ignore or is unseen by the database, because I put in a fake record and it's not returning anything. FML.

The edited sql that you showed works (that's what "Execute stored procedure" does).

#realJSOP 1-Jun-22 7:00am View    
More weirdness - If I make the parameter in the stored proc nullable, it works. I shouldn't have to do that.