473,396 Members | 2,147 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,396 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 20 '05 #1
5 5031
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 20 '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 20 '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 20 '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 20 '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 20 '05 #6

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

Similar topics

4
by: ralphNOSPAM | last post by:
Is there a function or otherwise some way to pull out the target text within an XML tag? For example, in the XML tag below, I want to pull out 'CALIFORNIA'. ...
0
by: Pentti | last post by:
Can anyone help to understand why re-parsing occurs on a remote database (using database links), even though we are using a prepared statement on the local database: Scenario: ======== We...
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...
3
by: Pir8 | last post by:
I have a complex xml file, which contains stories within a magazine. The structure of the xml file is as follows: <?xml version="1.0" encoding="ISO-8859-1" ?> <magazine> <story>...
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...
1
by: martinsson | last post by:
Hi all! I'm pretty mad about this... dont know what is going on. Im parsing XML file that looks like this: <something> __<item att="something">text<item> __<item...
31
by: broli | last post by:
I need to parse a file which has about 2000 lines and I'm getting told that reading the file in ascii would be a slower way to do it and so i need to resort to binary by reading it in large...
5
by: Benoit | last post by:
I've been instructing myself in XML DOM parsing using the w3schools tutorial and decided to try an example of my own. I'd written a short XML file that looked like this: <?xml version="1.0"...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.