Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Syntax Check of a DDL Query using SQL-DMO

Author  Topic 

rajender
Starting Member

13 Posts

Posted - 2005-05-05 : 03:04:19
Hi SQL Team

I am developing a SQL-DMO application, and i need to verify/validate the syntax of the DDL Query entered as text, much like the way SQL Enterprise Manager do while creating/altering a stored procedure.

for example i want to execute following statement using SQL-DMO's ExecuteImmediate Method

Alter Table Test Add Test_id int

Now before calling the following function, i want to validate the syntax of above statement.

Call xObject.Databases.Item(i).ExecuteImmediate(Text1.Text), where xObject is a instance of SQL-DMO.SqlServer2 and text1.text contains the above mentioned statement

I don't find any method/function to do that. Can any body help me how can i do that using SQL-DMO.



Thanks in advance.

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2005-05-05 : 09:28:06
If you run profiler while checking syntax in query analyzer, you'll see that before running the batch, Query Analyzer issues a SET PARSEONLY ON statement and SET PARSEONLY OFF when it's done.

You could do the same in your DMO app.


Damian
Ita erat quando hic adveni.
Go to Top of Page

rajender
Starting Member

13 Posts

Posted - 2005-05-06 : 03:11:17
Thanks Damian. It worked fine.
Go to Top of Page
   

- Advertisement -