Re: inserting a list
Your list of images and stock records: how is all that stored? Do you have multiple stock records? Matthew Walker Electric Sheep Web http://www.electricsheep.co.nz/ - Original Message - From: Boldacious Web Design [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 8:57 AM Subject: inserting a list Hi I have a list of images image01.jpg, image02.jpg, image03.jpg associated with one stock record eg 1045 I want to insert these into a table like so: 1045 - image01.jpg 1045 - image02.jpg 1045 - image03.jpg Can anyone help me with the code for this please? Seamus Seamus Campbell Boldacious WebDesign http://www.boldacious.com [EMAIL PROTECTED] ph 02 6297 4883 fax 02 6297 8464 mob 0410 609 267 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: inserting a list
Here is a stored procedure I wrote awhile back, hopefully it is some use to you.. it takes in a comma delimited list (you can change the delimiter if need be) and does an insert for each element in the list: This is just a section of it... you will have to alter it to get it to work, but not much. ALTER procedure sp_AssociateMMS ( @HazardID int, @list varchar(1000), @UserID int ) AS SET NOCOUNT ON DECLARE @separator_position int DECLARE @list_value varchar(1000) DECLARE @separator char(1) SET @separator = ',' IF @list != 'empty' BEGIN SET @list = @list + @separator END -- If the list passed in is not empty, loop through -- it and insert each MMS ID into the HazMMSLink -- table WHILE patindex('%' + @separator + '%' , @list) 0 BEGIN SELECT @separator_position = patindex('%' + @separator + '%' , @list) SELECT @list_value = left(@list, @separator_position - 1) IF @list_value != '' OR @list_value != ',' BEGIN INSERT INTO HazMMSLink(Haz_ID, MMS_ID, Record_Change_User_ID) VALUES(@HazardID,@list_value,@UserID) END SELECT @list = stuff(@list, 1, @separator_position, '') END COMMIT TRAN add_mms END - Original Message - From: Boldacious Web Design [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 8:57 AM Subject: inserting a list Hi I have a list of images image01.jpg, image02.jpg, image03.jpg associated with one stock record eg 1045 I want to insert these into a table like so: 1045 - image01.jpg 1045 - image02.jpg 1045 - image03.jpg Can anyone help me with the code for this please? Seamus Seamus Campbell Boldacious WebDesign http://www.boldacious.com [EMAIL PROTECTED] ph 02 6297 4883 fax 02 6297 8464 mob 0410 609 267 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
[Reply To] Re: inserting a list
They come from an xml update file (I am using an XML tag from http://www.torchbox.com called XML Toolkit) So my images come in a query as image01.jpg image02.jpg image03.jpg I just changed the delimiters from a space to a comma. I have multiple stock records. I have a loop for updating a single image with its correct stock record but I think I need an inner loop to acocunt for multiple images for a single stock record (hope this makes sense) many thanks Seamus You wrote Your list of images and stock records: how is all that stored? Do you have multiple stock records? Matthew Walker Electric Sheep Web http://www.electricsheep.co.nz/ - Original Message - From: Boldacious Web Design [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Saturday, June 07, 2003 8:57 AM Subject: inserting a list Hi I have a list of images image01.jpg, image02.jpg, image03.jpg associated with one stock record eg 1045 I want to insert these into a table like so: 1045 - image01.jpg 1045 - image02.jpg 1045 - image03.jpg Can anyone help me with the code for this please? Seamus Seamus Campbell Boldacious WebDesign http://www.boldacious.com [EMAIL PROTECTED] ph 02 6297 4883 fax 02 6297 8464 mob 0410 609 267 ~ ~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribef rumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=129.110 4 Seamus Campbell Boldacious WebDesign http://www.boldacious.com [EMAIL PROTECTED] ph 02 6297 4883 fax 02 6297 8464 mob 0410 609 267 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4