Tips and Tricks for SQL-BI
Tips and Tricks for SQL Server Developers
SQL Server Questions and Answers
Tuesday, June 8, 2010
T-SQL Puzzle 4 - Can we rollback after TRUNCATE?
You know that TRUNCATE is DDL command and we can't rollback DDL commands as per BOL.
So what will be the output of below query:
CREATE TABLE
Test(Col
int
)
GO
INSERT INTO
Test (Col)
VALUES
(1), (2), (3)
SELECT
*
FROM
Test
BEGIN TRAN
TRUNCATE TABLE
Test
SELECT
*
FROM
Test
ROLLBACK TRAN
SELECT
*
FROM
Test
DROP TABLE
Test
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Here are few FREE resources you may find helpful.
No comments:
Post a Comment