You can drop more than one column by separating them with a ",". SELECT * INTO #TempTable FROM WHERE = :id ĪLTER TABLE #TempTable DROP COLUMN I edit my solution with the idéas from Michael Dibbets. But this solution is nice for making a copy with a new auto-id. He wanted to copy the id to another column also. Hmm, I saw that I did not really give the answer that he wanted. You may want to use " CREATE TABLE" and " UPDATE TABLE" at row 1 and 2. It's better than the other way around anyway. The "id"-column is the identity column and that's the only column I have to specify. INSERT INTO MyTable_T SELECT * FROM TempTable SELECT * INTO TempTable FROM MyTable_T WHERE id = 1 I only have to specify the identity column(s). Ok, I know that it's an old issue but I post my answer anyway.
0 Comments
Leave a Reply. |