Parsing a Text File for an SQL Statement

  • Thread starter Thread starter Amos Soma
  • Start date Start date
A

Amos Soma

Has anyone written a utility (preferrably in C#) that takes a text file or
string and extracts any SQL statements (e.g., Select, Insert, Update,
Delete, Alter etc.) contained in the file or string?

Thanks very much.
 
Hi

If your file only contains T-SQL statements, then why not prepend a SET
NOEXEC ON statement and pass it through osql?

John
 
Yeah, what he said!!!!

John Bell said:
Hi

If your file only contains T-SQL statements, then why not prepend a SET
NOEXEC ON statement and pass it through osql?

John
 
John,

It doesn't, and there is a reason why I just want the SQL statements
extracted from the file.

Thanks.
 
Hi Amos,

I've just been talking to Larry in a post about a utility that he has that
extracts text based on regular expressions.

If that would be of interest, the topic is languages.vb: "Simple Reg
Expression question", 7th Sep.

If not, what sort of file and string contents are we talking about? Have
you any examples ?

It may be easier than you think to write a routine.

Regards,
Fergus
 
Hi Amos,

I'm not sure what kind of program you are going to write. Does this program
only parse the SQL statements or run them? What's the format of the text
file? Is each statement with a carriage return?

Please provide me with more information, so that I can deliver my
assistance more quickly

If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top