Ok, In a stored proc I would just do a select above the insert and stick the return into a variable.
I know I have done plenty of select into kinds of things. I also might be getting confused with stuff in oracle like insert into tabel(a,b,c) select a,b,c from table2 where this=that Or I might just be all screwed up. The thing is I am doing multiple inserts into some link tables and I don't want to have to do a loop outside the query block and end up recreating all kinds of database connections. It's no biggie, just someone put in a not null constraint that doesn't make any sense to me and is forcing me to do something I don't want to. This schema is mainly taken from a client's DB and some of it isn't exactly normalized :) Tim -----Original Message----- From: Tony Weeg [mailto:[EMAIL PROTECTED] Sent: Thursday, July 07, 2005 10:37 PM To: CF-Community Subject: Re: SQL Question i guess its a dumb question but... you dont/cant know that value prior to the query running? im not sure ive EVER seen a select statement comingling with an insert statement in one operation. tw On 7/7/05, Loathe <[EMAIL PROTECTED]> wrote: > Oh, > > It's SQL Server 2000 btw. > > -----Original Message----- > From: Loathe [mailto:[EMAIL PROTECTED] > Sent: Thursday, July 07, 2005 10:29 PM > To: CF-Community > Subject: SQL Question > > > Is there anyway to make something like this work: > > insert into application_skills > ( > candidate_id, > skill_id, > proficiency_id, > skillType_id > ) > values > ( > <cfqueryparam value="#client.candidate_id#" > cfsqltype="CF_SQL_NUMERIC">, > <cfqueryparam value="#skill_id#" cfsqltype="CF_SQL_NUMERIC">, > <cfqueryparam value="#formData[i]#" cfsqltype="CF_SQL_NUMERIC">, > select skillType_id from computerSkills_lookup where skill_id = > <cfqueryparam value="#skill_id#" cfsqltype="CF_SQL_NUMERIC"> > ) > > Where I essentially just select the value to insert into my fourth column? > It keeps blowing up. BTW this isn't in procedures, not sure if I can just > do a select prior to the insert to get what I need and stick it in a > variable. > > Tim > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:5:163647 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54