Author Topic: SqlQuery SQL Syntax  (Read 4731 times)

cpelster

  • EA Novice
  • *
  • Posts: 15
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
SqlQuery SQL Syntax
« on: May 24, 2007, 04:23:35 am »
Hi,

i wonder if there is any documentation on the SQLQuery query syntax, for example what SQL dialect to uses, how to escape characters and so on.
Since EA runs on many databeses i guess there is some kind of db abstraction behind this function?

regards,

 christian

mark.myers

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: SqlQuery SQL Syntax
« Reply #1 on: October 16, 2007, 03:46:16 pm »
Anyone got any info on this?
I'd like it too.
Cheers, Mark

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8085
  • Karma: +118/-20
    • View Profile
Re: SqlQuery SQL Syntax
« Reply #2 on: October 16, 2007, 06:07:16 pm »
I would treat it as though you are making a direct query to the database being used.

mark.myers

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: SqlQuery SQL Syntax
« Reply #3 on: October 16, 2007, 07:36:10 pm »
Already tried that - doesn't work.

I've added an extra table to the repository to store some additional info and tried a query such as:

IF OBJECT_ID (N'dbo.ut_Configurations', N'U') IS NOT NULL SELECT ConfiguredValue FROM ut_Configurations WHERE ParameterName='BaseDirectory'

which is valid syntax for SQL Server and runs correctly in SQL Management Console but not via SQLQuery which returns an empty string.
Cheers, Mark

bmioch

  • EA User
  • **
  • Posts: 81
  • Karma: +0/-0
    • View Profile
Re: SqlQuery SQL Syntax
« Reply #4 on: October 16, 2007, 09:06:06 pm »
Personally, I would treat everything as Access.

From the EA Help for the parameter for SQLQuery: "SQL is a string containing an SQL Select Statement."

Your SQL has more than just a select statement. Does the select work on its own?

mark.myers

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: SqlQuery SQL Syntax
« Reply #5 on: October 16, 2007, 09:55:12 pm »
Yes the select by itself works fine. I just wanted to do a check for the existance of the table as not all repositories I connect to have it. I have worked around it by checking if it is a SQL repository (I know the EAP ones wont have it).

I needed to do this because SQLQuery displays a dialog box saying the table is not found if the table doesn't exist. I have my SQLQuery inside a try/catch but evidently SQLQuery doesn't throw an exception but rather displays the (unwanted) dialog. :(
Cheers, Mark

bmioch

  • EA User
  • **
  • Posts: 81
  • Karma: +0/-0
    • View Profile
Re: SqlQuery SQL Syntax
« Reply #6 on: October 17, 2007, 03:12:04 pm »
I would suggest you log the no-exception as a bug or feature request.