Sorry stepped away from the computer a couple days to get married WOOT!

now back to work <crackwhip />

What I've come up with is:
 <cfquery name="Insert_user_provider_services" datasource="#DSN#">
    IF NOT EXISTS (SELECT
ups_id_pk,ups_provider_fk,ups_client_fk,ups_service_fk
                 FROM user_provider_services
                WHERE ups_provider_fk = <cfqueryparam
cfsqltype="cf_sql_integer" value="#form.provider" />
                  AND ups_client_fk = <cfqueryparam
cfsqltype="cf_sql_integer" value="#form.client" />
                  AND ups_service_fk = <cfqueryparam
cfsqltype="cf_sql_integer" value="#form.service" />)
    INSERT INTO user_provider_services
               (ups_provider_fk,ups_client_fk,ups_service_fk)
         VALUES (<cfqueryparam cfsqltype="cf_sql_integer"
value="#form.provider" />
                ,<cfqueryparam cfsqltype="cf_sql_integer"
value="#form.provider" />
                ,<cfqueryparam cfsqltype="cf_sql_integer"
value="#form.service" />)
</cfquery>


Thanks for the input guys.  For some reason a former employer drilled it
into the team that Auto incrementing PK's were dead weight if you could
composite a key with existing data, and I'm finding old habits die hard.

OK back to the honeymooning!


On Jan 14, 2008 12:22 PM, Dave Watts <[EMAIL PROTECTED] > wrote:

> > > An auto Incrementing PK just makes it easier to insert a
> > > duplicate.
> >
> > Not if the column is marked as a PK.
>
> I think that Richard means, it's easier to insert duplicate data values
> with
> a surrogate key. This is certainly true, unless you place constraints on
> the
> natural key as well.
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
>
> Fig Leaf Software provides the highest caliber vendor-authorized
> instruction at our training centers in Washington DC, Atlanta,
> Chicago, Baltimore, Northern Virginia, or on-site at your location.
> Visit http://training.figleaf.com/ for more information!
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:296681
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to