SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How to empty database


How to empty database

Author
Message
Nebojsa Ilic
Nebojsa Ilic
Old Hand
Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)

Group: General Forum Members
Points: 321 Visits: 290
Comments posted to this topic are about the item How to empty database
luis 94471
luis 94471
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 8
Hi
I tried to paste your script to empty a database into a query in SQL 2008 management studio and I keep getting the following set of errors:
Msg 102, Level 15, State 1, Line 74
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 75
Incorrect syntax near ' '.

This is the lfirst line inside the While.. loop for cursor c. I have tried to change it, and nothing works unless I remove all lines inside the while loop (which is obviously defeating the purpose of the script!). Can you please suggest what I am doing wrong? I would like to use your script to see if I can empty my database just before deploying it

Luis Valentim
Nebojsa Ilic
Nebojsa Ilic
Old Hand
Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)

Group: General Forum Members
Points: 321 Visits: 290
Hi Luis,
This script was written while SQL 2000 was actual version. I'll be back when I do test (or rewrite) on 2008.

Boka
web.newmarch
web.newmarch
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
Points: 1 Visits: 5
Hi,

I would encourage you to revisit this script sooner rather than later. I would very much like to use if with SQL Express 2005. I get a few more errors than in the previous post.
Msg 102, Level 15, State 1, Line 74
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 75
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 79
Incorrect syntax near ' '.
Msg 102, Level 15, State 1, Line 80
Incorrect syntax near ' '.
Msg 156, Level 15, State 1, Line 84
Incorrect syntax near the keyword 'CLOSE'.
Nebojsa Ilic
Nebojsa Ilic
Old Hand
Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)Old Hand (321 reputation)

Group: General Forum Members
Points: 321 Visits: 290
Hi Luis,

It looks that problem was just in copying script from web page to query window. It added some special characters.
You can find file with unchanged script attached. I have tested it on SQL 2005 Developer Edition and it works fine. Of course it should be rewritten to use new system views but I don't have time for that right now. Please let me know if this works for you.
Attachments
DeleteFromAllTablesInDB.sqlplan (26 views, 2.00 KB)
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search