473,385 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Parsing a Text File for an SQL Statement

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.
Nov 15 '05 #1
5 2675
Hi

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

John

"Amos Soma" <no****@yahoo.com> wrote in message
news:eD**************@TK2MSFTNGP11.phx.gbl...
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.

Nov 15 '05 #2
Yeah, what he said!!!!

"John Bell" <jb************@hotmail.com> wrote in message
news:3f***********************@news.easynet.co.uk. ..
Hi

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

John

"Amos Soma" <no****@yahoo.com> wrote in message
news:eD**************@TK2MSFTNGP11.phx.gbl...
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.


Nov 15 '05 #3
John,

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

Thanks.

"John Bell" <jb************@hotmail.com> wrote in message
news:3f***********************@news.easynet.co.uk. ..
Hi

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

John

"Amos Soma" <no****@yahoo.com> wrote in message
news:eD**************@TK2MSFTNGP11.phx.gbl...
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.


Nov 15 '05 #4
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
Nov 15 '05 #5
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."

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Amos Soma | last post by:
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...
1
by: Christoph Bisping | last post by:
Hello! Maybe someone is able to give me a little hint on this: I've written a vb.net app which is mainly an interpreter for specialized CAD/CAM files. These files mainly contain simple movement...
3
by: toton | last post by:
Hi, I have some ascii files, which are having some formatted text. I want to read some section only from the total file. For that what I am doing is indexing the sections (denoted by .START in...
13
by: Chris Carlen | last post by:
Hi: Having completed enough serial driver code for a TMS320F2812 microcontroller to talk to a terminal, I am now trying different approaches to command interpretation. I have a very simple...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.