Row_Number 生成样本数据

table: tb_email,

需要在email column里面逐条插入“1@test.com","2@test.com","3@test.com"

UPDATE D
SET email = mail
FROM [tb_email] D JOIN
(
SELECT id,
cast(ROW_NUMBER() over (order by id) as varchar) + '@test.com' as mail
FROM [tb_email]
) Temp
ON D.id = Temp.id

posted @ 2015-05-19 11:52  悠哉游哉  阅读(153)  评论(0)    收藏  举报