Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2011
    Posts
    4

    Unanswered: How to parse sql

    Hi experts,

    I am looking to parse sql queries in sybase. To parse and validate the syntax without executing the sql code.

    In oracle similar is done by using DBMS_SQL.PARSE. Please let me know any pointers regarding this.

    Thanks in advance.

    Regards,
    neuron

  2. #2
    Join Date
    Jun 2010
    Posts
    51
    Not sure if there is actually an option to do this in sybase. But you can always use a trick:
    Code:
    set noexec on
    go
    This command will result in not executing the query by sybase, compile time error should however be picked up.

    Just make sure that this query is your first in the sql batch.

    Let us know how it goes.

    Thanks,
    Meet
    Please always reply to the post if it was helpful. Others may find it helpful.

  3. #3
    Join Date
    Jan 2011
    Posts
    4
    thanks meet.

    I am looking to parse sqls on ASA 11, I think 'set noexec on' will work on SQL Server 2005/2008. Can you please confirm?

    Also what is the equivalent to do this on ASA 11.

    regards,
    neuron

  4. #4
    Join Date
    Jan 2003
    Location
    Massachusetts
    Posts
    5,800
    Provided Answers: 11
    SQL Server and Sybase derive from a common ancestor. SET NOEXEC ON should work in both.

  5. #5
    Join Date
    Jan 2011
    Posts
    4
    Sure, I will give a try and let know updates.

    However also read about "SQLDIALECT - the SQLDIALECT function returns 'Watcom-SQL' or 'Transact-SQL' if the SQL is valid, and an error message if not.

  6. #6
    Join Date
    Jan 2011
    Posts
    4
    SQLDIALECT works but it just works on the syntax of query. Suppose the column name does not exists or the table itself does not exists then also it validates the query without errors.

    when tried 'set noexec on' it says transact-SQL feature not supported. What else can be done here?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •