February 4, 2003 at 1:45 pm
I have a query where I need to insert 1 to n records where n is an integer. There is only a single field in the table and it is called 'Period' I'm looking for the most efficient SLQ possible, performance is must
Can the SQL be in a single statement?
On a slightly different note...I need to append records that are the result of a cartesian product. Is there a fast way to append these records or a different alternative to using a cartesian product.
Thanks,
Mike
February 7, 2003 at 8:00 am
This was removed by the editor as SPAM
February 10, 2003 at 3:02 am
Do not know of a way to insert multiple records without selecting from another table.
You could create a permanent table with the maximum number of entries and then select from that table
insert into tablename
select num from numtable
where num <= 20
Other than that, only by using a loop
declare @n int
set @n = 0
while n<=20
begin
set @n = @n + 1
insert into tablename values (@n)
end
As for your second question, do not know what would be faster than standard INSERT INTO...
would depend on table design, volume etc.
I suppose performance would be judged by the cartesian rather than the inserts.
Far away is close at hand in the images of elsewhere.
Anon.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply