Re: How can I insert multiple rows in a single SQL statement

From: Tim Gilbert <timothy.j.gilbert_at_removethis.boeing.com>
Date: Mon, 22 Jul 2002 17:28:10 GMT
Message-ID: <3D3C40AA.978D26F0_at_removethis.boeing.com>


Did you try putting a ";" between the insert statements in your query? This allows multiple SQL commands in a single statement.

Tim

Ryan Hennessy wrote:
>
> Good morning,
>
> I'm having trouble coming up with a way to insert multiple rows worth of
> arbitrary values into a table in a single SQL query. The values are
> coming from the C layer overtop the database, as opposed to coming from
> a select on another table. My only tool here is sprintf, which I can
> use to incrementally build the query string.
>
> I am disappointed that insert into will only take a single row of
> values, and that similarly, a stored procedure that inserts a row of
> values can only be called once. I desperately need to reduce the number
> of transactions to one. Somebody has made the suggestion that I could
> select my values into a temporary table, and then use insert on that,
> but I am unsure if this is the best method available to me. I can't
> make a stored procedure to insert multiple rows at once, because I can't
> make the stored procedure take a variadic number of arguments, and the
> values are too random for simple loops to work.
>
> Can somebody think of anything clever?
>
> Thanks,
> Ryan.
Received on Mon Jul 22 2002 - 19:28:10 CEST

Original text of this message