Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2005
»
T-SQL (SS2K5)
»
Batch Processing
Batch Processing
Rate Topic
Display Mode
Topic Options
Author
Message
NightCrawler
NightCrawler
Posted Wednesday, November 26, 2008 10:58 AM
Forum Newbie
Group: General Forum Members
Last Login: Thursday, November 27, 2008 8:33 AM
Points: 6,
Visits: 49
"
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
Post #609319
Tim Mitchell
Tim Mitchell
Posted Wednesday, November 26, 2008 5:32 PM
Ten Centuries
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 4:11 PM
Points: 1,033,
Visits: 2,593
You'll need to provide some more information about what you are trying to do, your environment, etc.
Tim Mitchell
SQL Server MVP
www.TimMitchell.net
twitter.com/Tim_Mitchell
Post #609514
RBarryYoung
RBarryYoung
Posted Wednesday, November 26, 2008 7:50 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Saturday, May 04, 2013 11:13 AM
Points: 9,855,
Visits: 9,374
Specifically, you need to explain what "
i need to update {0} to another database
' means, because it makes no sense.
-- RBarryYoung
,
(302)375-0451
blog:
MovingSQL.com
, Twitter:
@RBarryYoung
Proactive
Performance Solutions, Inc.
"Performance is our middle name."
Post #609531
Lynn Pettis
Lynn Pettis
Posted Wednesday, November 26, 2008 8:44 PM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 9:22 AM
Points: 21,599,
Visits: 27,419
Could it be he is trying to drop multiple databases? Only the OP knows for sure.
Lynn Pettis
For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here
or
when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here
and
here
Managing Transaction Logs
SQL Musings from the Desert
Fountain Valley SQL
(My Mirror Blog)
Post #609539
Tim Mitchell
Tim Mitchell
Posted Wednesday, November 26, 2008 8:46 PM
Ten Centuries
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 4:11 PM
Points: 1,033,
Visits: 2,593
That's how I interpreted his post. That could go wrong in a hurry.
Tim Mitchell
SQL Server MVP
www.TimMitchell.net
twitter.com/Tim_Mitchell
Post #609540
RBarryYoung
RBarryYoung
Posted Wednesday, November 26, 2008 9:43 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Saturday, May 04, 2013 11:13 AM
Points: 9,855,
Visits: 9,374
Hmm, that's an angle I hadn't thought of. Still, I'd like some clarification from the OP.
-- RBarryYoung
,
(302)375-0451
blog:
MovingSQL.com
, Twitter:
@RBarryYoung
Proactive
Performance Solutions, Inc.
"Performance is our middle name."
Post #609554
Lynn Pettis
Lynn Pettis
Posted Wednesday, November 26, 2008 9:45 PM
SSC-Insane
Group: General Forum Members
Last Login: Today @ 9:22 AM
Points: 21,599,
Visits: 27,419
Actually, I think that is what we are all waiting for.
Lynn Pettis
For better assistance in answering your questions, click here
For tips to get better help with Performance Problems, click here
For Running Totals and its variations, click here
or
when working with partitioned tables
For more about Tally Tables, click here
For more about Cross Tabs and Pivots, click here
and
here
Managing Transaction Logs
SQL Musings from the Desert
Fountain Valley SQL
(My Mirror Blog)
Post #609555
NightCrawler
NightCrawler
Posted Thursday, November 27, 2008 7:23 AM
Forum Newbie
Group: General Forum Members
Last Login: Thursday, November 27, 2008 8:33 AM
Points: 6,
Visits: 49
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.
Post #609805
Tim Mitchell
Tim Mitchell
Posted Thursday, November 27, 2008 8:30 AM
Ten Centuries
Group: General Forum Members
Last Login: Wednesday, May 08, 2013 4:11 PM
Points: 1,033,
Visits: 2,593
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
SQL Server MVP
www.TimMitchell.net
twitter.com/Tim_Mitchell
Post #609852
RBarryYoung
RBarryYoung
Posted Thursday, November 27, 2008 10:44 AM
SSCrazy Eights
Group: General Forum Members
Last Login: Saturday, May 04, 2013 11:13 AM
Points: 9,855,
Visits: 9,374
*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.
-- RBarryYoung
,
(302)375-0451
blog:
MovingSQL.com
, Twitter:
@RBarryYoung
Proactive
Performance Solutions, Inc.
"Performance is our middle name."
Post #609921
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.