Is there a limit to the size of a SQL command that I am trying to execute?

J

john

I would like to be able to run a batch sql script from inside my
application on a SQL Server 2K database. The script has all sorts of
commands (inserts, updates, deletes, creating indexes, etc.). It's the
sort of thing that I could copy into a window of Query Analyzer and
run. It could be pretty big (if saved to a text file on my hard drive,
it's over 1 meg). What is the best way to execute it with ADO.NET? I
could have a string that is the entire script and try to use
ExecuteNonQuery, but I don't know if there is a limit to the size of
this query. Another application of this thinking is if I need to
insert a bunch of records, it would probably have better performance
(i.e. less round-trips to the database) if I put a bunch of of the
INSERT statements into one string and execute it than to execute a
bunch of different INSERT statement strings.

Thanks in advance.
 
I

Imaya kumar

-----Original Message-----
Can you create a Stored Procedure and just pass in the parameters?



.


You try putting your DB Code in the Database itself and
call it as a stored procedure.. Or if u don;t wanna do it,
than using String, use the Stringbuilder class and
increase the capacity of the String builder Object and
continue using it..
-Imaya kumar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top