Inserting records into database in a bulk

Inserting records using SqlBulkCopy
When there comes the necessity of inserting a lots of rows into database (for example, when importing data from a flat file (excel, csv) or when importing data from one database into another one), and you need to do it programmatically, because it needs to be pre-processed on the fly, then you [...]


Drop identity property from an existing column

Code That Drops the IDENTITY Property from an Existing Column

-If other tables’ foreign keys point to the IDENTITY column, drop them. Here, the script drops the foreign key pointing to Orders2.OrderID from OrderDetails2.

ALTER TABLE OrderDetails2

DROP CONSTRAINT FK_OrderDetails2_Orders2

–If a primary key exists on the IDENTITY column, drop the primary key constraint the way this script drops [...]


Share to Facebook Share to Twitter Stumble It Share on Tumblr Digg More...