Jump to content

How run sql file with AutoIt?


Melkor
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...