How to copy/duplicate rows in sql2008
Hello i have table with ID,LongID,Categoty,Priority
ID LongID Category Priority
218 2432 301 1
222 2445 301 2
205 2416 301 3
214 2425 302 1
5 1079 302 2
152 2388 302 3
143 2382 303 1
89 2263 303 2
126 2375 303 3
Sow i building duplicate function,Ex: If i curently in category 301 and
press duplicate i will find the next available Category ID (Category
max)+1 that mean 304 and copy all rows from categoty 301 to 304
ID LongID Category Priority
218 2432 301 1
222 2445 301 2
205 2416 301 3
214 2425 302 1
5 1079 302 2
152 2388 302 3
143 2382 303 1
89 2263 303 2
126 2375 303 3
218 2432 304 1 <-new 304
222 2445 304 2<-new 304
205 2416 301 3<-new 304
Sow how can i do this?
No comments:
Post a Comment