Oh, so IOW I can only do that for one join table, not more than one? 
I have a couple of lookup columns that I'll be inserting...

Pete

On Apr 11, 2005 12:54 PM, Gareth Arch <[EMAIL PROTECTED]> wrote:
> You've more or less posted the answer.  The method to use would be:
> 
> INSERT INTO  tblContactAddress(contactID,addressTypeID,address1, etc.)
> SELECT #contactIDValue#, ID, '#address1Value#',etc.
> FROM tblAddressType
> WHERE typename = 'General'
> 
> Just make sure typename = 'General' will only return one value or it will 
> insert those values each time it finds 'General' in tblAddressType (i.e. if 
> you have 3 typename = 'General' it will insert 3 records)
> 
> >I'm making life harder on myself than I need to.  Salient facts:
> >CFMX7, SQL Server 2000
> >
> >I'm trying to insert an address.  The contact address table has the
> >usual fields, i.e. id, contactID, address1, address2, city, state,
> >zip, etc., but it also has an addressTypeID that is a lookup column
> >that references values in an addressType table that has typeid,
> >typename
> >
> >What I _WANT_ to be able to do is something like this:
> >
> >INSERT INTO  tblContactAddress(contactID,addressTypeID,address1, etc.)
> >VALUES  (#contactIDValue#, (SELECT ID FROM tblAddressType WHERE
> >typename = 'General'), '#address1Value#',etc.)
> >
> >Of course, I would be using cfqueryparam for all variables.
> >
> >SQL Server doesn't like this.  Is there a way to accomplish what I'm after?
> >
> >Thanks!
> >
> >Pete
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:202206
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to