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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 loop through file/table

Author  Topic 

collie
Constraint Violating Yak Guru

400 Posts

Posted - 2007-08-02 : 04:02:10
Hi,

I am supposed to get either an excel file or access to the customer's database and then loop through either the file or table in the db and insert the data received into a table in my database.
I can not use the Import wizard as I have to do some processing on the data received such as checking duplicates, checking mandatory fields and errrors.

I have a sp that does the insert but it's not a loop and i am not sure how to modify it to use a loop.
Unfortunately, I can't show the insert sp that i made as our servers are down and we only have access to the internet.

Any help will be appreciate.

Whisky-my beloved dog who died suddenly on the 29/06/06-I miss u so much.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-08-02 : 04:47:24
Why would you loop record for records?
SQL Server is setbased. It can do the work for you in one operation.

Read about OPENROWSET or LINKED SERVER.



E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page
   

- Advertisement -