PDA

View Full Version : SQL Script Error


emunn
06-04-2009, 03:14 PM
Got the following question about our new SQL training and wasn't sure what the error might be. The error arrives after they have copied the scripts from the DVD and confirm the proper paths. Any ideas?

Deleting database file 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\veronicas_log.LDF'.
Deleting database file 'c:\Program Files\Microsoft SQL Server\MSSQL\Data\veronicas.mdf'.
The CREATE DATABASE process is allocating 0.63 MB on disk 'veronicas'.
The CREATE DATABASE process is allocating 0.49 MB on disk 'veronicas_log'.
Msg 170, Level 15, State 1, Line 18
Line 18: Incorrect syntax near '('.
Msg 170, Level 15, State 1, Line 24
Line 24: Incorrect syntax near '('.
Msg 170, Level 15, State 1, Line 14
Line 14: Incorrect syntax near '('.
Msg 208, Level 16, State 82, Line 3
Invalid object name 'Flowers'.
Msg 208, Level 16, State 82, Line 3
Invalid object name 'Customers'.
Msg 208, Level 16, State 82, Line 3
Invalid object name 'Orders'.

Mel
06-04-2009, 04:17 PM
Which script are you running from which video?

The first time you run the script in the video 5 folder the veronicas database does not exist so you will get the following error message because there is no database there yet to delete...

Msg 3701, Level 11, State 1, Line 3
Cannot drop the database 'veronicas', because it does not exist or you do not have permission.
(444 row(s) affected)
(39507 row(s) affected)
(1054 row(s) affected)
(3110 row(s) affected)
(81200 row(s) affected)


...but the script will continue on and create the database for you.

Whenever you re-run the script to refresh the database (after ripping it to shreds) you should not get any messages about not being able to delete the DB.

Mel
06-04-2009, 04:39 PM
One more thing...
I can't see your PC so I don't know what "confirm the proper paths" resulted in.
So let me say something about the file paths...

1) Create a folder named "coursefiles" off the C: drive.
2) All the "script" sub folders should be copied to "c:\coursefiles\"

So the path for the files for video 05 should be
c:\coursefiles\video05

for video 06 should be
c:\coursefiles\video06

etc., etc., etc

The word scripts should not be in the path. If you don't have a C: drive or want to run the SQL from another location you will need to modify the .sql files to match the new path.