Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 1st, 2005, 04:47 PM
samcneal samcneal is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 75 samcneal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 26 m 2 sec
Reputation Power: 4
backup file name

I'm running this backup script but it is stripping the backup file name. Any ideas, why? It was working correctly before we change our naming convention for the databases and move the test databases to a new Test DB Svr.
I think it has something to do with the new path location.
Code:
DECLARE @DBName NVARCHAR(100), @Device NVARCHAR(100), @Name NVARCHAR(150) DECLARE cur_DBs CURSOR STATIC LOCAL FOR SELECT     Catalog_Name
                                                                                                                                                                                                                                                                                                                 FROM         Information_Schema.Schemata
                                                                                                                                                                                                                                                                                                                 WHERE     [Catalog_Name]
                                                                                                                                                                                                                                                                                                                                        NOT IN ('MASTER',
                                                                                                                                                                                                                                                                                                                                        'MODEL', 
                                                                                                                                                                                                                                                                                                                                       'MSDB', 
                                                                                                                                                                                                                                                                                                                                       'TEMPDB')
                                                                                                                                                                                                                                                                                                                                        OPEN cur_DBs
                                                                                                                                                                                                                                                                                                                                        FETCH NEXT
FROM         cur_DBs
INTO            @DBName WHILE @@FETCH_STATUS = 0 BEGIN
SET              @Device = N'\\DestinyDev\c$\Program Files\Microsoft SQL Server\MSSQL\BACKUP\DATA\' + @DBName + '_Diff_' + LEFT(REPLACE(REPLACE(REPLACE(CONVERT(NVARCHAR(30),  
                       GETDATE(), 120), '-', ''), ':', ''), ' ', ''), 12) + N'.BAK'
SET              @Name = @DBName + N' Diff Backup' PRINT 'Backing up database ' + @DBName BACKUP DATABASE @DBName TO DISK = @Device WITH DIFFERENTIAL,
                       NOUNLOAD, NAME = @Name, NOSKIP, STATS = 10, NOFORMAT RESTORE VERIFYONLY
FROM         DISK = @Device WITH FILE = 1 PRINT '--------------------------------------- ' FETCH NEXT
FROM         cur_DBs
INTO            @DBName END CLOSE cur_DBs DEALLOCATE cur_DBs

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > backup file name


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT