We help IT Professionals succeed at work.
Get Started

TSQL - Nested Loop Inserts

356 Views
Last Modified: 2012-05-11
This is also just a question in general that I'd like to know, but, I need to perform a bulk insert, which I can accomplish in ColdFusion. The problem is that it times out, and I'd rather do this on SQL Server anyway.

Query 1 - Get Client IDs

Query 2 - Get Location IDs

Relationship 1-M Q1,Q2

code ---
get client query

loop client query
   get location query
        loop location query
             insert into ClientLocation table
             values (clientID,LocationID)
              ...
         end loop
    ...
end loop


I'm familiar with a basic bulk insert in sql


insert into (col1,col2)
select this, that from table
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 2 Answers and 5 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE