Posted by Cecil on 11/08/52 11:37
I get this error:
Msg 137, Level 15, State 2, Line 2
Must declare the scalar variable "@DBName".
W/ this code:
--Constants
DECLARE @DBName varchar(20);
SET @DBName = 'Base';
GO
--Create & Use Database @DBName
USE master
GO
if exists (select * from sysdatabases where name=@DBName)
drop database @DBName
GO
CREATE DATABASE @DBName
GO
use @DBName
GO
How should this be done?
Navigation:
[Reply to this message]
|