Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Babli
Yak Posting Veteran
53 Posts |
Posted - 2007-01-31 : 05:45:27
|
| Hi,I have parent table with the columnsID (P.Key) FilePath1 /documents/articles2 /images/movies3 /letters/JanuaryAnd another table that needs to be updatedUrl FilePathIDhttp://sitename//documents/articles Nullhttp://sitename/images/movies Nullhttp://sitename/letters/January NullThe FilePath ID should be 1,2,3 respectively.Instead of writing a number of Update statements I want a single Update statement , I tried with Union but got errors.Do you have any other option. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-01-31 : 05:52:01
|
| update t2set t2.filepathid = (select t1.id from table1 as t1 where t2.url like '%' + t1.filepath)from table2 as t2Peter LarssonHelsingborg, Sweden |
 |
|
|
Babli
Yak Posting Veteran
53 Posts |
Posted - 2007-01-31 : 07:12:03
|
Thanks it works greatquote: Originally posted by Peso update t2set t2.filepathid = (select t1.id from table1 as t1 where t2.url like '%' + t1.filepath)from table2 as t2Peter LarssonHelsingborg, Sweden
|
 |
|
|
|
|
|