Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Command files

  • 09-04-2001 8:19pm
    #1
    Registered Users, Registered Users 2 Posts: 2,894 ✭✭✭


    Can anyone point me to a site that gives the basics to command files (.cmd) in relation to executing batch jobs on sql servers and the like ?


Comments

  • Registered Users, Registered Users 2 Posts: 21,264 ✭✭✭✭Hobbes


    A CMD file is just a BAT file only it runs in NT. Allows for extra functionality as well which I can't remember off the top of my head (like cmd library calls).

    type cmd /? then help * where *=the cmd command you want more information on.

    As for the SQL command. You need to know the program that allows command line running. I don't offhand know what that program is.

    Have you tried checking the help for command line options?


  • Registered Users, Registered Users 2 Posts: 2,494 ✭✭✭kayos


    Tin what sort of job are you tring to run? You can use the cmd box from SQL itself with xp_cmdshell and its variants. SQL Server comes with a job schedualer which will aloow you to a hell of a lot of things. If you job is say to back up the db and move the backup some where you can do this all through SQL. Post up what sort of job you want to do and I'll give you a hand. In the mean time check out MSSQL BOL and the MSDN Libary.

    kayos


  • Registered Users, Registered Users 2 Posts: 2,894 ✭✭✭TinCool


    Well, talking more of bcp, have sq2000 on my pc at home and i'm tinkering around with the bcp command. Can't get the ****er to work properly. Say, taking northwind as the database and i want to bcp to a text file the products table, how do i format the bcp command ?


  • Registered Users, Registered Users 2 Posts: 16,414 ✭✭✭✭Trojan


    I dunno much aboot bcp or sql, but here's some batch file info for ya.

    Dead handy for stuff like building our system every night and ftp'ing to the mainframe if the build was successful, otherwise sent a netsend. Pretty cool for dos...

    Here's some pages:

    http://www.getty.net/texts/batch.txt
    http://www.robvanderwoude.com/index.html

    Al.



  • Registered Users, Registered Users 2 Posts: 2,494 ✭✭✭kayos


    BCP is easy enough
    bcp "SELECT au_fname, au_lname FROM pubs..authors ORDER BY au_lname" queryout Authors.txt -c -Sservername -Usa -Ppassword
    
    this is pretty much what you want. If you have SQL 2k you should have the BOL which is full of useful info. Also try bcp /? smile.gif hmmm I best go to bed work in the morning frown.gif hope this helps

    kayos


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 2,894 ✭✭✭TinCool


    Thanks for the help guys, sorted out my little problem


Advertisement