开发者

Duplicate all rows in sql database table

开发者 https://www.devze.com 2022-12-27 10:05 出处:网络
I have a table which contains house details called property. I am creating a localised application, and I have a db table called propertylocalised. In this table is held duplicates of the data and cul

I have a table which contains house details called property. I am creating a localised application, and I have a db table called propertylocalised. In this table is held duplicates of the data and culture column e.g.

key  culture propertyname

1     en       helloproperty

1     fr       bonjourproperty

At the moment I开发者_StackOverflow社区 have all my en culture inserted but I want to duplicate all of those rows and then for every other row insert fr into culture.

I obviously only want to do this once, for the purpose of setting up the localisation.

Thanks

Andy


INSERT INTO table 
SELECT 'fr', propertyname
FROM table

assuming you want to duplicate all the existing records which are all 'en'


insert into propertylocalised select key,'fr'propertyname from propertylocalised  where culture = 'en'
0

精彩评论

暂无评论...
验证码 换一张
取 消