dimanche 8 février 2015

insert data in sql server from other table


Vote count:

0




I've some records in table_3 and I want to insert that record to table_2 but value of first column (Id) will be (NUMBER+1) of table_1. My code is



INSERT INTO TABLE_2(Id,NAME)
SELECT (SELECT MAX(NUMBER) FROM TABLE_1)+1 AS Id,name
FROM TABLE_3


Count of table_1 is 200. and count of TABLE_3 is 10. I want new inserted Ids are like


(201,202,203,204,205,206,207,208,209,210)


but from query am getting is like...


(201,201,201,201,201,201,201,201,201,201)



asked 1 min ago







insert data in sql server from other table

Aucun commentaire:

Enregistrer un commentaire