Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2004
    Posts
    1

    Unanswered: Use batch File to update SQL

    Ok.. I thought I could do this but I can't get this to work.. I need to create a batch file to run an sql update statement.. This is simple but I can't get it to wortk.. How do I do it?

  2. #2
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734

    Re: Use batch File to update SQL

    Originally posted by kledford
    Ok.. I thought I could do this but I can't get this to work.. I need to create a batch file to run an sql update statement.. This is simple but I can't get it to wortk.. How do I do it?
    Use osql.


    osql /U alma /P mypassword /i titles.qry

    If you can use trusted security replace the /U and /P with /E.
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  3. #3
    Join Date
    Feb 2004
    Location
    San Antonio, TX
    Posts
    565
    a common way to use the osql is to create a script (*.sql File) that contains the TSQL Statement that you want to execute.
    then you should call that script as an input file and you should define an output file
    the final thing you should think about is who is going to run the statement is it going to be an SQL Login or will it be run by a Windows Login?
    then place the entire statement into a windows batch file and it's a double click away.

    the switches are the ones specified above by derrickleggett
    (by the way they are case sensitive)

    [Books Online] OSQL

  4. #4
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    This suggestions is half facetious, half for real. Learn Perl.

    Perl comes on the Windows 2000 Resource Kit CD. Perl is also available for free download at Perl.org.

    Perl has become the mother of all scripting languages on the net. It runs on most server platforms. Including: Z-OS for mainframes, most flavors of Windows, most flavors of Unix, and every flavor of Linux I've ever used.

    It does ODBC, uses many of the Windows bells and whistles, parses files (the pattern matching makes C# look like a cheap toy). There are mountains of free scripts available to do positively amazing things.

    Oh yeah, I kinda like Perl too.

    -PatP

  5. #5
    Join Date
    Feb 2004
    Location
    San Antonio, TX
    Posts
    565

    Re: Use batch File to update SQL

    Originally posted by kledford
    Ok.. I thought I could do this but I can't get this to work.. I need to create a batch file to run an sql update statement.. This is simple but I can't get it to wortk.. How do I do it?

    Perl?

    Facetious?

    PERL!!?!!?

    RDJABAROV!!!!!!!!!!!!! HELP!!!!!!!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •