|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Doing inserts in a loop?
hello
I have pulled some data (one column named Codes) using some select queries and where clauses. Now all the data for column Codes should be added in some table called tableForA. But before I do that I need to pull some information from colorsOfCodes where I will be looking up records based on data of Codes. this sounds confusing. let me put some columsn. got this from a select query Codes -------- car house gift colorsOfCodes (table): Codes Color ------ ----- car green house red gift yellow tableForA (table): now in tableForA is where I want to insert all records from column Codes that I got from a select query. each element in that selec query needs to fetch data from table colorsOfCodes and then be inserted in tableForA. can someone please help? |
|
#2
|
|||
|
|||
|
There is no need for a loop
insert into tableForA select from Codes join colorsOfCodes |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Doing inserts in a loop? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|