Hi All, I need to update two tables based on the third table ID. I am passing an ID of table 1 from my code as string with comma delimited so '1,2,3' and want to update two tables based on that ID. I have below tables:[code]Table1ID Tbel2ID Tabl3ID1 5 662 23 763 46 17[/code][code]Table2ID Col25 Test123 Test2 46 Test388 Test499 Test5Table3ID Col266 Test588 Test1154 Test1076 Test317 Test65[/code]I need to update Col2 of Table2 and Col2 of Table3 and I am passing Table1 ID's as a parameter in the stored procedure so if I am passing 1,2,3 and Col2 value for table2 as "Test6" and Col2 value for table3 as Test100 all the 5,23,46 ID's for Table2 to be changed to Test6 and 66, 76, 17 to be changed to Test 100 so the final table will look like this:[Code]Table2ID Col25 Test623 Test6 46 Test688 Test499 Test5Table3ID Col266 Test10088 Test1154 Test1076 Test10017 Test100[/code]The stored proc will be something like this:[code]Create procedure dbo.Sp_test( @ID int @Table1Col1Value varchar(200), @Table1Col2Value varchar(200))[/code]any help will be appreciated.
↧