How to use a varying database?

Posted by nimo on Stack Overflow See other posts from Stack Overflow or by nimo
Published on 2010-05-25T12:07:23Z Indexed on 2010/05/25 12:11 UTC
Read the original article Hit count: 206

Filed under:
|

I want to use a database which name is stored in a variable. How do I do this? I first thought this would work but it doesn't:

exec('use '+@db)

That will not change database context

Suggestions anyone?

© Stack Overflow or respective owner

Related posts about sql

Related posts about tsql