Posts

Showing posts with the label Delete

What is difference between DELETE and TRUNCATE commands?

Delete command removes the rows from a table based on the condition that we provide with a WHERE clause. Truncate will actually remove all the rows from a table and there will be no data in the table after we run the truncate command. TRUNCATE : TRUNCATE is faster and uses fewer system and transaction log resources than DELETE. TRUNCATE removes the data by deallocating the data pages used to store the table's data, and only the page deallocations are recorded in the transaction log. TRUNCATE removes all rows from a table, but the table structure, its columns, constraints, indexes and so on, remains. The counter used by an identity for new rows is reset to the seed for the column. You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint. Because TRUNCATE TABLE is not logged, it cannot activate a trigger. TRUNCATE cannot be rolled back. TRUNCATE is DDL Command. TRUNCATE Resets identity of the table DELETE : DELETE removes rows one at a time...

What is difference between DELETE & TRUNCATE commands?

What is difference between DELETE & TRUNCATE commands? Delete command removes the rows from a table based on the condition that we provide with a WHERE clause. Truncate will actually remove all the rows from a table and there will be no data in the table after we run the truncate command. TRUNCATE TRUNCATE is faster and uses fewer system and transaction log resources than DELETE. TRUNCATE removes the data by deallocating the data pages used to store the table’s data, and only the page deallocations are recorded in the transaction log. TRUNCATE removes all rows from a table, but the table structure and its columns, constraints, indexes and so on remain. The counter used by an identity for new rows is reset to the seed for the column. You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint. Because TRUNCATE TABLE is not logged, it cannot activate a trigger. TRUNCATE can not be Rolled back. TRUNCATE is DDL Command. TRUNCATE Resets identity of the table. DEL...

Deleting Columns and Parameters

Deleting Columns and Parameters A few types of objects appear in Schema View , even though you cannot delete them from Schema View . The examples are columns in a table and parameters of a stored procedure or function. Both these types of objects appear in Schema View so that you can better understand the table, procedure, or function without having to open its definition. However, each column and parameter is defined within the file that defines the entire table, procedure, or function. To delete these items, you must modify the definition for the table, procedure, or function. To delete a column from a table If Schema View does not appear, open the View menu, point to Other Windows , and click Schema View . In Schema View , click the table that contains the column that you want to delete. - or - In Solution Explorer , click the file containing the table that contains the column that you want to delete. ...