Previously : IndusSoft
Synametrics Technologies
Homepage Products Download Purchase Support Forum Partners Contact
Searching tips
.   





  • Download
  • Products
  • Knowledge Base
  • White Papers




  • Knowledge Base

    Document information

    Document ID:822
    Subject:Using command line arguments to run SQL queries
    Creation date:7/29/09 4:58 PM
    Last modified on:7/29/09 4:58 PM


    Details


    WinSQL allows you to run SQL queries passed from a command line. You can either run saved SQL queries in a plain text file or run export routines saved as a WinSQL export template.

    The following example shows how to run SQL scripts saved in a text file using WinSQL.

    WinSQL -dYourDNS -uYourUserID -pYourPwd "-qc:\scripts\myScripts.sql" -a -oc:\output.txt

    The following example runs queries stored in c:\scripts\myScripts.sql file using "YourDNS" as the data source, "YourUserID" as the user id, and "YourPwd" as your password. The "-a" option tells WinSQL to exit once the queries are completed. The "-oc:\output.txt" argument tells WinSQL to write any error messages to output.txt file.

    Common mistakes

    • Often users simply type the following at the command line
      WinSQL c:\scripts\myScripts.sql

      The above example will open the scripts in the editor window but won't run it automatically.
    • If you only specify the DNS and file name, for example
      WinSQL -qc:\Scripts.sql -dYourDSN
      WinSQL will prompt you for a user id and password. This defeats the purpose of running queries in an unattended manner.



    User comments

    Posted by mpjain on 4/20/11 11:49 AM

    CREATE TABLE USKCPL.PAYALLSAL (PAYDATE DECIMAL(8,0), DCIDEA CHAR(6) NOT NULL, DCIDEN SMALLINT NOT NULL, NAME CHAR(25) NOT NULL, DAYS DECIMAL(8,2) , DCMCA INT , BAS INT , HRA INT , CONV INT , MED INT , WAS INT , DRV INT , FUEL INT , ENT INT , TOTE INT , ADV INT , EPF INT , ESI INT , ITAX INT , LOAN INT , PF INT , PTAX INT , TOTD INT , NET INT ) INSERT INTO USKCPL.PAYALLSAL (PAYDATE,DCIDEA,DCIDEN,name,DAYS,dcmca,BAS,HRA,CONV,MED,WAS,DRV,FUEL,ENT,TOTE,ADV,EPF,ESI,ITAX,LOAN,PF,PTAX,TOTD,NET) SELECT 20101101,DCIDEA,DCIDEN,name,DAYS,dcmca,BAS,HRA,CONV,MED,WAS,DRV,FUEL,ENT,TOTE,ADV,EPF,ESI,ITAX,LOAN,PF,PTAX,TOTD,NET FROM USKCPL.PAYSALARY DELETE FROM USKCPL.PAYSALARY Requirements is above three steps : run continuesly, Step-I is Create Step-II is insert Step-III is Delete., what is continue run exec command in above scripts....Pl.advswe....MPJAIN


    Add a comment to this document

    Do you have a helpful tip related to this document that you'd like to share with other users? Please add it below. Your name and tip will appear at the end of the document text.
    Your name:
    Your email:
    Hide my email address
    Verification code:
    Enter the verification code you see above more submitting your tip
    Tip:Please limit tips to 1000 characters


    Site map | Contact | Products | Support
    Powered by 10MinutesWeb.com