troubleshooting Question

TSQL - Nested Loop Inserts

Avatar of coldchillin
coldchillin asked on
Microsoft SQL Server 2008ColdFusion Language
5 Comments2 Solutions358 ViewsLast Modified:
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

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros