hi,
can anyone explain why this is returning an error when executing?
the returned error is
Line 1: Incorrect syntax near '_56Test'.
which is referring to @dbname after 'name = ' + ...
any advice is appreciated. thanks in advance!
..:: mirirom ::..
can anyone explain why this is returning an error when executing?
Code:
USE master
DECLARE @dbname sysname
SET @dbname = '234_56Test'
EXECUTE
('IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name = ' + @dbname + ')
DROP DATABASE ' + @dbname)
GO
the returned error is
Line 1: Incorrect syntax near '_56Test'.
which is referring to @dbname after 'name = ' + ...
any advice is appreciated. thanks in advance!
..:: mirirom ::..