This is tricky. Update select query is possible using Join in sql server.
Example:
Update rest_cuisine_type
Set rest_cuisine_type.cuisine_name = temp.cuisine_name
from rest_cuisine_type inner join (Select
Tab.Col.value('cuisine_type_id[1]','int') AS cuisine_type_id,
Tab.Col.value('cuisine_name[1]','varchar(40)') AS cuisine_name
FROM @rest_cuisine_type.nodes('//cuisine_types/ctype') AS Tab(Col)
) As temp
on rest_cuisine_type.cuisine_type_id= temp.cuisine_type_id
where @rest_cuisine_type is xml type variable.
No comments:
Post a Comment