exec failed because the name not a valid identifier?

后端 未结 2 977
天涯浪人
天涯浪人 2020-12-15 02:08

I have a query I need run it as a dynamic query to output a meaningful column name. As an example, if I run the query directly, it returns data correctly. However, if I use

2条回答
  •  失恋的感觉
    2020-12-15 03:05

    As was in my case if your sql is generated by concatenating or uses converts then sql at execute need to be prefixed with letter N as below

    e.g.

    Exec N'Select bla..' 
    

    the N defines string literal is unicode.

提交回复
热议问题