Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Batch Processing Expand / Collapse
Author
Message
Posted Wednesday, November 26, 2008 10:58 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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
Posted Wednesday, November 26, 2008 5:32 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 9:07 PM
Points: 1,046, Visits: 2,738
You'll need to provide some more information about what you are trying to do, your environment, etc.



Tim Mitchell, SQL Server MVP
Independent Business Intelligence Consultant
www.TimMitchell.net
@Tim_Mitchell

Post #609514
Posted Wednesday, November 26, 2008 7:50 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: 2 days ago @ 11:54 AM
Points: 9,294, Visits: 9,492
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
Posted Wednesday, November 26, 2008 8:44 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 11:10 AM
Points: 20,808, Visits: 32,746
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
Posted Wednesday, November 26, 2008 8:46 PM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 9:07 PM
Points: 1,046, Visits: 2,738
That's how I interpreted his post. That could go wrong in a hurry.



Tim Mitchell, SQL Server MVP
Independent Business Intelligence Consultant
www.TimMitchell.net
@Tim_Mitchell

Post #609540
Posted Wednesday, November 26, 2008 9:43 PM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: 2 days ago @ 11:54 AM
Points: 9,294, Visits: 9,492
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
Posted Wednesday, November 26, 2008 9:45 PM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Today @ 11:10 AM
Points: 20,808, Visits: 32,746
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
Posted Thursday, November 27, 2008 7:23 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum 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
Posted Thursday, November 27, 2008 8:30 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Tuesday, November 11, 2014 9:07 PM
Points: 1,046, Visits: 2,738
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
Independent Business Intelligence Consultant
www.TimMitchell.net
@Tim_Mitchell

Post #609852
Posted Thursday, November 27, 2008 10:44 AM


SSCrazy Eights

SSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy EightsSSCrazy Eights

Group: General Forum Members
Last Login: 2 days ago @ 11:54 AM
Points: 9,294, Visits: 9,492
*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 »

Add to briefcase

Permissions Expand / Collapse