SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 copying elements more efficiently
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Vivaldi
Constraint Violating Yak Guru

USA
298 Posts

Posted - 07/12/2001 :  09:24:01  Show Profile  Reply with Quote
Hey all,

Basic question,
I have a table structure as so.

Title
id | title

Component
ID | code | titleid

County
id | countyname

countybudget
id | countyid | componentid | money

the asp page passes
1 - N county ids and a title id

I want to copy all componentids for a given titleid into the CountyBudget Table for each county.

However, I only want to insert if the record does not exist.

This is quite simple in ASP, create an array of the components and run some code within a Loop, but this is very INefficient and I am trying to improve my use of stored procs.

Is there a way that is better than simply using a cursor and doing the logic?

Thanks much

Software Composer
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000