Link to home
Start Free TrialLog in
Avatar of Robb Hill
Robb HillFlag for United States of America

asked on

SQL - Curser to do an insert based on a select

Its has been years since I wrote a curser and was hoping for some guidence.


Lets say I have a select statement that returns me a unique list of Customers

So here is the select

Select  c.Customer
FROM CustomerTable.c

So I would need to iterate through each c.Customer

And create an insert based on the values of that row in the select.

So the insert is another table...and the 3 values in the insert are from the row im interating on.

--INSERT INTO [dbo].[tClientXContact]
--([nIDClient]
--,[c.Customer]
--,[lNotify])
--SELECT distinct c.nid, c.Customer,1
ASKER CERTIFIED SOLUTION
Avatar of Matt Bowler
Matt Bowler
Flag of New Zealand image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Robb Hill

ASKER

THanks for getting me rolling...I appreciate it!!