var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: How to access tables from a dynamic
I have a procedure that takes database name and queries some tables in the database specified. I am trying to access tables like this:
SELECT COUNT(id) FROM @dbname..sysobjects WHERE type='U'
How can I access the tables while the database name is in a variable.
You can do it with an exec call:
Originally Posted by TALAT
EXEC('SELECT COUNT(id) FROM ' + @dbname + '..sysobjects WHERE type = ''U''')
The U value needs to be surrounded by 2 pairs of single quotes, because it is a string within a string.