C
cableone
Here is what probably is a stupid question, I do this all the time in
coldFusion, but I would like to do it all in transact-sql. Basically, I have
table A with records, I want to loop over the records in tableA and insert 1
(or a few) in tableB essentially:
begin
select top 10 * from members
INSERT INTO test
(
hello
)
VALUES
(
'a'
)
end
the top statement returns a list (the select top 10), and inserts 1 record
to "test" with "a" in the hello field. I want it to insert 10 records, and
mabe even change 'a' to values pulled from "members"
In cold fusion, I just do:
Execute "theSelectQuery"
<cfloop query='theSelectQUery">
insert ... (values from theSelectQuery)
</cfloop< (end loop)
coldFusion, but I would like to do it all in transact-sql. Basically, I have
table A with records, I want to loop over the records in tableA and insert 1
(or a few) in tableB essentially:
begin
select top 10 * from members
INSERT INTO test
(
hello
)
VALUES
(
'a'
)
end
the top statement returns a list (the select top 10), and inserts 1 record
to "test" with "a" in the hello field. I want it to insert 10 records, and
mabe even change 'a' to values pulled from "members"
In cold fusion, I just do:
Execute "theSelectQuery"
<cfloop query='theSelectQUery">
insert ... (values from theSelectQuery)
</cfloop< (end loop)