Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I am trying to write a SP that will select a group of records (normally not more than 10) and then insert the information into a new table with a few changes.I have my stored procedure that extracts all the info I need but now how do I reiterate through my results in a SP and insert them into another table?Thanks,Gavin
SamC
White Water Yakist
3467 Posts
Posted - 2003-11-21 : 07:29:59
You need to give more informaiton.It depends.
INSERT INTO dbo.MyTableNew (MyData1, MyData2, MyData3) SELECT DataA * 2, DataB / 3 , DataC * DataA From dbo.MyTableOld Where condition
This query inserts modified data into a new table. But it's probably not meeting the "few changes" requirement you mention.Could you post the source table DDL, target table DDL, some sample data and what the data changes are?Sam