I am having a problem with a simple SQL Server script. For some reason, after I drop the PIMTool database it does not get created. The "IF not EXISTS (Sel....*" on line 5 is not getting executed. Because the PIMTool DB does not created I get an error message on line 8 on the "Use PIMTool". ANy suggestions?
if exists (SELECT name FROM Master.dbo.sysdatabases WHERE name = N'PIMTool')
drop DATABASE [PIMTool];
IF not EXISTS (SELECT name FROM Master.dbo.sysdatabases WHERE name = N'PIMTool')
CREATE DATABASE [PIMTool];
Server: Msg 911, Level 16, State 1, Line 8
Could not locate entry in sysdatabases for database 'PIMTool'. No entry found with that name. Make sure that the name is entered correctly.