Link to home
Create AccountLog in
Avatar of bobPUNKbob
bobPUNKbob

asked on

SQL to copy a record and insert it using a specified new primary key

I have an 80 coluimn table with lots of records and the Primary key is a column named OrderNum (and is NOT an identity field). I need to insert a new record with all identitical values as an existing record based on the OrderNum, except obviously the OrderNum can't be the same, so I need to assign the newly inserted OrderNum.

What would be the best SQL statement to accomplish this?
Let's say the record I need to copy is OrderNum=100500
and I need to assign the new record Ordernum=101880
ASKER CERTIFIED SOLUTION
Avatar of tigin44
tigin44
Flag of Türkiye image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of bobPUNKbob
bobPUNKbob

ASKER

Thanks!