开发者

# ifdef type conditional compilation in T-SQL sql server 2008 2005

For sake of backwards compatibility I need to have a stored proc run on both sql server 2005 AND sql server 2008. However due to some commands being deprecated in sql serv开发者_运维技巧er 2008 my script compiles on 2005 but fails on 2008. I am looking for the c++, c# equivalent of #define, #ifdef so I can compile the same script on 2005 & 2008. What is the standard practice on this ? Attached screenshot explains in detail. thank you

# ifdef type conditional compilation in T-SQL sql server 2008 2005


Use dynamic SQL:

if (@returnVal = 1)
    exec ('backup log myDB with truncate_only');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜