Jump to content
Sign in to follow this  
Melkor

How run sql file with AutoIt?

Recommended Posts

Melkor

I have any files with sql expressions(long sql statements)

I can with help _sql.au3 run any simple querry( select or update or ..). But if I want to execute complex querry - I get no results.

I can run this files(on MsSQL) by osql.exe, but I want to use AutoIt.

Does anybody know, how to do it on AutoIt?

long sql statements for examle:

IF OBJECT_ID('[dbo].[V_OperGang]','V') IS NOT NULL
    DROP VIEW [dbo].[V_OperGang]
GO
CREATE VIEW [dbo].[V_OperGang]
AS
SELECT
    og.*,
    CONVERT(decimal(16, 2), 0) AS SummToDayEnd,
    sr.ReportNumber,
    fd.FirstChequeDate
FROM
    OperGang og
    LEFT JOIN ShiftReports sr ON
        og.ReportID = sr.Id
    LEFT JOIN (
        SELECT
            MIN(DateOperation) AS FirstChequeDate,
            shopindex,
            operday,
            cash_code,
            NSmena
        FROM
            ChequeHead (NOLOCK)
        GROUP BY
            shopindex,
            operday,
            cash_code,
            NSmena ) fd ON  fd.shopindex = og.shopindex
                            AND fd.operday = og.operday
                            AND fd.cash_code = og.CashNumber
                            AND fd.NSmena = og.GangNumber
GO

Luck, Love and PatienceNikita

Share this post


Link to post
Share on other sites
SmOke_N

replace all the line feeds with a space and try it.


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites
Melkor

Thanks for your advices! I'll try to use it.

Scriptes are not mine, but I must run its on database. It means, that I should prepare scriptes...

And I think it will be not work, if in script there are variables(for example DECLARE @variable INT). But I'll try :graduated:


Luck, Love and PatienceNikita

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.