September 28, 2006 at 11:25 pm
Hello Everyone,
i m using MySql,i have a table in this i have 3 clomun
group_id section_value aro_id
i want to insert maximum 700 records in this table but
the problem is i have a constant value let say "18" in the column "group_id" , section_value is empty and the last column "aro_id varies from 15 to 700
plz tell me how i inserted this type of record
reply me asap
its very urgent
September 29, 2006 at 10:07 am
I failed to understand your question, are u trying to understand how the data is inserted or do you want a solution for inserting the records as explained by you.
Prasad Bhogadi
www.inforaise.com
September 29, 2006 at 10:54 am
isa,
You're pretty vague about where the data you are inserting is coming from. This example assume you are inserting data from another table.
Insert
DestTable
(
group_id,
section_value,
aro_id
)
Select Top 700
src.group_id,
src.section_value,
src.aro_id
From
SourceTable src
Where
src.group_id = 18
September 30, 2006 at 1:24 am
Thankyou so much for replying me , i want to insert new record in my table , not want to insert record which is coming from other table .
i m using Mysql 4.1.
thanx in advance.
September 30, 2006 at 10:13 am
It would appear that Isa want's to manufacture data (for test or otherwise) with a random number generator for the "Aro_ID" column.
Isa, one question that remains is "Can there be dupes in the "Aro_ID" column?
--Jeff Moden
Change is inevitable... Change for the better is not.
October 1, 2006 at 11:09 pm
Hello Jeff, no there is no duplicates for "Aro_ID" column
October 2, 2006 at 3:55 am
Still not sure I understand the question, but maybe this is it?
DECLARE @counter INT
SET @counter = 14
WHILE @counter < 700
BEGIN
SET @counter= @counter+1
INSERT INTO your_table group_id, section_value, aro_id
SELECT '18', NULL, @counter
END
I suppose this is just for one-time filling of a test table, not something you will call repeatedly during some procedure. If it isn't, you should consider other ways of doing this, because of performance.
P.S.: This is SQL Server 2000 syntax (and SQL 2000 forums). I don't know MySQL, so I can't guarantee it will work there.
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply