I want to assign database name into the declared variable and this is how I tried already:
DECLARE @DBname VARCHAR(100)
SET @DBname = 'PatientTurningSystem'
SELECT TABLE_NAME, TABLE_TYPE
FROM @DBname.INFORMATION_SCHEMA.TABLES
But I get the following error:
Msg 102, Level 15, State 1, Procedure SP_TableDeatails, Line 8
Incorrect syntax near '.'
varchar
variables and parameters that you use. Your@DBName
variable is right now exactly ONE character long - so that won't work anyway.... useDECLARE @DBName VARCHAR(100)
or whatever makes sense in your case – PostpaidDECLARE @DBname VARCHAR(100)
but it has also error. – Comras