Jump to content



Photo

SQL Script Help

sql help script fail

  • Please log in to reply
1 reply to this topic

#1 Circaflex

Circaflex

    Neowinian Senior

  • Tech Issues Solved: 2
  • Joined: 18-August 02
  • Location: California
  • OS: 8 x64, 7 x64, Mountain Lion, Ubuntu
  • Phone: hammerhead

Posted 23 September 2013 - 23:26

Hey guys so i have another assignment I am having trouble with. We just setup SQL Server and are creating a script, it asks to run parse first to ensure no errors, then execute. I have attached the pdf of the script i had to copy into sql along with my script in txt format.

i run parse and it opens a new window, but seems to just stop until i hit continue, it then says it completed successfully. when i try to execute the script it get this error, "Msg 2714, Level 16, State 6, Line 5
There is already an object named 'DEPARTMENT' in the database." I am hoping I am just over looking the error. Thanks

 

Attached File  sql.zip   130.63KB   10 downloads




#2 Kami-

Kami-

    ♫ d(-_-)b ♫

  • Tech Issues Solved: 2
  • Joined: 28-July 08
  • Location: SandBox

Posted 24 September 2013 - 12:04

Well quite simply, you already have an object in your database named 'Department', if you're all sharing a database that'll be why.

 

Effectively if want to do a check to see i the database object already exists, if not then create it (or drop and recreate it if that's what you want).