Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Getting the INFORMATION_SCHEMA.TABLES from a databasename.

$
0
0
Hello

I want to achieve something like this:

Code:

DECLARE @dbName nvarchar(100)

SET @dbName = 'TestDatabase'
SELECT * FROM
@dbName.INFORMATION_SCHEMA.TABLES

But of course, the string, ehm, the nvarchar @dbName does not have the property INFORMATION_SCHEMA on it, so, is it possible to cast the dbName into a database-object, so the INFORMATION_SCHEMA lives...?

Viewing all articles
Browse latest Browse all 13329

Trending Articles