November 26, 2008 at 10:58 am
"
EXEC dbo.sp_delete_backup @database_name = M'{0}'
GO
USE [master]
GO
ALTER DATABASE [{0}] SET SINGLE_USER WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE [{0}] SET SINGLE_USER
GO
USE [master]
GO
DROP DATABASE [{0}]
GO
"
Above is the script i use to delete the database{0}. Now i need to update {0} to another database called "DateAgain".
Please provide a script to update. Thanks in advance
November 26, 2008 at 5:32 pm
You'll need to provide some more information about what you are trying to do, your environment, etc.
Tim Mitchell
TimMitchell.net | @tmitch.net | Tyleris.com
ETL Best Practices
November 26, 2008 at 7:50 pm
Specifically, you need to explain what "i need to update {0} to another database' means, because it makes no sense.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
November 26, 2008 at 8:44 pm
Could it be he is trying to drop multiple databases? Only the OP knows for sure.
November 26, 2008 at 8:46 pm
That's how I interpreted his post. That could go wrong in a hurry.
Tim Mitchell
TimMitchell.net | @tmitch.net | Tyleris.com
ETL Best Practices
November 26, 2008 at 9:43 pm
Hmm, that's an angle I hadn't thought of. Still, I'd like some clarification from the OP.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
November 26, 2008 at 9:45 pm
Actually, I think that is what we are all waiting for.
November 27, 2008 at 7:23 am
I am really sorry for the delay.
Environment is... everyday a set of databases are created(sales business). i.e. at the end of the day I have to delete these databases(ofcourse after saving to other disc) For that I am using the above mentioned script. Apart from this, I have to update these databases in another database name"DateAgain".
I apologize for the confusion. This is the new task given to me. And I am completely confused from my task point of view.
November 27, 2008 at 8:30 am
Are the database names always the same from one day to the next? If so, you could use a For Each Loop and create a static list of database names to drop at the end of the day.
hth,
Tim
Tim Mitchell
TimMitchell.net | @tmitch.net | Tyleris.com
ETL Best Practices
November 27, 2008 at 10:44 am
*sigh*
Again, this statement:
I have to update these databases in another database name"DateAgain".
makes no sense. You cannot "Update" one database to another (or "on" another, or "in" another, etc.). There is no such operation in SQL and this phrase does not mean anything.
Please explain.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply