T-SQL: How to use parameters in dynamic SQL?

后端 未结 4 1767
春和景丽
春和景丽 2020-11-30 11:33

I have the following dynamic query which is working fine without the WHERE clause, which is expecting UNIQUEIDENTIFIER.

When I pass it in,

4条回答
  •  隐瞒了意图╮
    2020-11-30 11:54

    I'm not sure if your variable is getting populated in string format or binary, but you may need to quote the uniqueidentifier in your where clause. If you just select the uniqueidentifier field, does it come back as string or binary?

提交回复
热议问题