November 27, 2007 at 2:11 am
Hi :),
I am developing an Application same as Query Analyser. But unable to parse a query through my application.
Please advise...
November 27, 2007 at 2:21 am
Manu Raj Patel (11/27/2007)
Hi :),I am developing an Application same as Query Analyser. But unable to parse a query through my application.
Please advise...
Maybe I do not understand you correctly (sorry if this is the case), but when you say "to parse a query" do you mean it does not execute or are you trying to implement the "Parse only" functionality? In the latter case just prepend your statements with
"set parseonly on" and SQL Server will let you know if there are any syntax problems with your statement.
Regards,
Andras
November 27, 2007 at 2:27 am
SET NOEXEC ON
Run the query.
With noexec on, all SQL will do is parse and compile the query. If it encounters syntax errors, you'll get the error back.
I could be mistaken, but I think it's all the QA does.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
November 27, 2007 at 2:29 am
HI,
Thanks for your reply...
Actually I am not parsing the query on query analyser but I need to check whether the syntax are correct or not in the query which is in a simple text box on my application.
November 27, 2007 at 4:55 am
If you want to parse it from your client, use the code that Gail provided from there.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
November 27, 2007 at 5:03 am
Grant Fritchey (11/27/2007)
If you want to parse it from your client, use the code that Gail provided from there.
I am developing this on VB 6.0. Can you please provide how I can use this...
November 27, 2007 at 5:14 am
Gail gave it to you
SET NOEXEC ON
Put that in front of the query with a semi-colon seperating it from your code. This works against Adventureworks:
SET NOEXEC ON;
SELECT * FROM [Sales].[CreditCard]
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 7 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply