Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Simple SQL Question

by Zecho (Hermit)
on May 08, 2003 at 20:23 UTC ( #256667=perlquestion: print w/replies, xml ) Need Help??

Zecho has asked for the wisdom of the Perl Monks concerning the following question:

Sorta offtopic, sorta not.. I simply need someone to verify the syntax of this SQL statement...
strSQL = "UPDATE AccountAuthorizationInformation INNER JOIN AccountSta +tus ON [AccountAuthorizationInformation].[Account_Authorization]=[Acc +ountStatus].[Account_Authorization] SET AccountAuthorizationInformati +on.Settle_Date = [AccountStatus].[Status_Date] WHERE (([AccountStatus +].[Account_Authorization] = [AccountAuthorizationInformation].[Accoun +t_Authorization]) And ([AccountAuthorizationInformation].[Settle_Date +]=''));"
Gracias... Zecho

Replies are listed 'Best First'.
Re: Simple SQL Question
by artist (Parson) on May 08, 2003 at 20:46 UTC
    Making it a perl question:

    use SQL-Statement to parse and check the validity of your query.

    Beautify your existence.

Re: Simple SQL Question
by chromatic (Archbishop) on May 08, 2003 at 20:33 UTC

    It's difficult to verify without knowing which database and which version of the database you're using.

    That said, it's pretty easy to verify an update by turning it into a select and running it against your test database. It's also often possible to run it through your database's query analyzer, which should tell you about syntax errors.

Re: Simple SQL Question
by TVSET (Chaplain) on May 08, 2003 at 21:51 UTC
    Firstly, some indent would be nice.

    Secondly, why cannot you just stick that SQL up the database and see what it will tell you. If you have an error in there, then take it one small step at a time.

    P.S.: ObfuSQL is something... :)

    Leonid Mamtchenkov aka TVSET

Re: Simple SQL Question
by Abigail-II (Bishop) on May 08, 2003 at 22:30 UTC
    It's invalid.

    Abigail (you don't tell where you want it to be valid, so I won't tell you where it is invalid. Not that this is a Perl question anyway).

Re: Simple SQL Question
by talexb (Canon) on May 09, 2003 at 14:40 UTC

    If your original code were rewritten as

    UPDATE AccountAuthorizationInformation INNER JOIN AccountStatus ON [AccountAuthorizationInformation].[Account_Authorization] = [AccountStatus].[Account_Authorization] SET AccountAuthorizationInformation.Settle_Date = [AccountStatus].[Status_Date] WHERE ( ( [AccountStatus].[Account_Authorization] = [AccountAuthorizationInformation].[Account_Authorization]) And ( [AccountAuthorizationInformation].[Settle_Date]='') )
    it would be clearer. Except for square brackets around the table and field names, it looks like SQL.

    Was that your question?

    And this has what to do with Perl?

    --t. alex
    Life is short: get busy!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://256667]
Approved by VSarkiss
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2020-12-05 12:35 GMT
Find Nodes?
    Voting Booth?
    How often do you use taint mode?

    Results (63 votes). Check out past polls.