开发者

Use a specific database depending on condition

Can I somehow use a specific database given a specific condition? To clarify I will give a naive example:

CASE 
    WHEN @开发者_StackOverflow中文版dbnum = 1 THEN USE Db1
        ELSE USE DefaultDb
END


You can do it with an IF:

IF @dbnum = 1
    USE Db1;
ELSE
    USE DefaultDb;
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜