Inserting data into a duplicate table, without entering column names

Filed in SQL Leave a comment

INSERT INTO DeletedPK SELECT * FROM PK WHERE PKId = 33

Creating a table by coping old table structure copy in SQL 2005

Filed in SQL Leave a comment

E.g 1

SELECT * INTO NewTblName FROM ExistingTblName WHERE 1 = 0

E.g 2

SELECT * INTO NewTblName FROM

(SELECT PKId, PKStatusId, P.CreatedDate, P.LastModifiedDate, PayOptId, AccountNo, RoutingNo, Pin, DedOfferAmount,  IntTrackNo, Lang, RequestUrl, PCode, PromoCodeAmount, S.[SId], FirstName, LastName, Address1, Address2, Address3, City, [State], ZipCode, Country, Phone, Email, [Password]  FROM Sel S, Pro P WHERE 1 = 0 ) AB

TOP