Click here to Skip to main content
15,896,378 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
@command=N'
use ' + @DBName + N'

this is the right way to pass the variable name for parameter?
Posted
Comments
Purna.N 23-Jan-14 2:24am    
Can give me some clarity in the question ....
What you are doing using above variable..

1 solution

You can't do that. You can't change the DB you're using, based on a variable. IF you were doing a select, or an insert, then yes, you'd use the variable that way. However, you would not use quotes, or a + sign. I assume you're doing this in SQL, not in code.

Why would you set the DB you're using, based on a parameter ? Sounds like a broken design to me
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900