SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Other Forums
 Other Topics
 DOS -Q
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

X002548
Not Just a Number

15586 Posts

Posted - 07/28/2010 :  15:03:14  Show Profile  Reply with Quote
Why am I getting a syntax error?


COPY \\PAERSCBVD0402\D$\BACKUP\PAERSCBVD0402\QA\databases\blddistm\blddistm_MIGRATE.BAK \\PAERSCBVD0403\D$\BACKUP\PAERSCBVD0402\QA\databases\blddistm\blddistm_MIGRATE.BAK -QUIET 




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



tkizer
Almighty SQL Goddess

USA
35934 Posts

Posted - 07/28/2010 :  15:24:24  Show Profile  Visit tkizer's Homepage  Reply with Quote
Because -Q isn't available for copy command. Run copy /? from a cmd window to check it out.

Use xcopy instead.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
35934 Posts

Posted - 07/28/2010 :  15:24:48  Show Profile  Visit tkizer's Homepage  Reply with Quote
By the way, it's actually not DOS anymore. MOO

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 07/28/2010 :  17:02:44  Show Profile  Reply with Quote
you say potato, I say potato

What the hell is it then?

cmdshell?


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 07/28/2010 :  17:03:38  Show Profile  Reply with Quote
you couldn't just say /Y


Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

tkizer
Almighty SQL Goddess

USA
35934 Posts

Posted - 07/28/2010 :  17:06:49  Show Profile  Visit tkizer's Homepage  Reply with Quote
quote:
Originally posted by X002548

you say potato, I say potato

What the hell is it then?

cmdshell?




I've heard various ways to say it: cmd, command, cmdshell. The reason it's not DOS anymore is that DOS is an operating system. Windows hasn't needed DOS in a while.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
35934 Posts

Posted - 07/28/2010 :  17:09:36  Show Profile  Visit tkizer's Homepage  Reply with Quote
Whether or not you can use -Y is dependent upon your requirement. If you are trying to suppress the question prompt, then yes -Y.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 07/28/2010 :  17:13:20  Show Profile  Reply with Quote
MOO indeed...

So why does this stop after the copy...this in a bat file


osql -i D:\backup\paerscbvd0402\dev\databases\blddistm\sql\BackupCopyRestore.sql -o D:\backup\paerscbvd0402\dev\databases\blddistm\bin\Migrate_paerscbvd0402_dev_blddistm.log -E -S PAERSCBVD0402\DEV 
osql -i D:\backup\paerscbvd0402\dev\databases\blddistm\sql\MakeBKP.sql -o D:\backup\paerscbvd0402\dev\databases\blddistm\bin\MakeBKP.log -E -S PAERSCBVD0402\DEV 
        D:\backup\paerscbvd0402\dev\databases\blddistm\bin\CopyBKP.bat > D:\backup\paerscbvd0402\dev\databases\blddistm\bin\CopyBKP.log
osql -i D:\backup\paerscbvd0402\dev\databases\blddistm\sql\AlterDB.sql -o D:\backup\paerscbvd0402\dev\databases\blddistm\bin\AlterDB.log -E -S PAERSCBVD0403\DEV 
osql -i D:\backup\paerscbvd0402\dev\databases\blddistm\sql\RestoreBKP.sql -o D:\backup\paerscbvd0402\dev\databases\blddistm\bin\RestoreBKP.log -E -S PAERSCBVD0403\DEV 
osql -i D:\backup\paerscbvd0402\dev\databases\blddistm\sql\SetDB.sql -o D:\backup\paerscbvd0402\dev\databases\blddistm\bin\SetDB.log -E -S PAERSCBVD0403\DEV 




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 07/28/2010 :  17:14:39  Show Profile  Reply with Quote
I think you got that backwards


COPY [/D] [/V] [/N] [/Y | /-Y] [/Z] [/A | /B ] source [/A | /B]
    [+ source [/A | /B] [+ ...]] [destination [/A | /B]]

 source       Specifies the file or files to be copied.
 /A           Indicates an ASCII text file.
 /B           Indicates a binary file.
 /D           Allow the destination file to be created decrypted
 destination  Specifies the directory and/or filename for the new file(s).
 /V           Verifies that new files are written correctly.
 /N           Uses short filename, if available, when copying a file with a
              non-8dot3 name.
 /Y           Suppresses prompting to confirm you want to overwrite an
              existing destination file.
 /-Y          Causes prompting to confirm you want to overwrite an
              existing destination file.
 /Z           Copies networked files in restartable mode.




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam




Edited by - X002548 on 07/30/2010 10:09:21
Go to Top of Page

Kristen
Test

United Kingdom
22403 Posts

Posted - 07/29/2010 :  02:26:03  Show Profile  Reply with Quote
"So why does this stop after the copy"

osql ...
osql ...
CopyBKP.bat
osql ...
osql ...
osql ...

The BAT file will NOT return. You have to do

EXEC CopyBKP.bat

or somesuch (CMD CopyBKP.bat perhaps?) if you want it to return. And it may have to do its own ">" logging as the outer ">" may not apply.
Go to Top of Page

robvolk
Most Valuable Yak

USA
15635 Posts

Posted - 07/29/2010 :  07:04:27  Show Profile  Visit robvolk's Homepage  Reply with Quote
call CopyBKP.bat
Go to Top of Page

Kristen
Test

United Kingdom
22403 Posts

Posted - 07/30/2010 :  06:17:22  Show Profile  Reply with Quote
That's it! Thanks Rob.
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 07/30/2010 :  09:18:37  Show Profile  Reply with Quote
REALLY....

Thanks a bunch ladies and gents!!!

Beers are on me




Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000