Remove data from tables

  • robert.diley (3/10/2015)What it does log are page deallocations:

    "The DELETE statement removes rows one at a time and records an entry in the transaction log for each deleted row. TRUNCATE TABLE removes the data by deallocating the data pages used to store the table data and records only the page deallocations in the transaction log."

    Which is why TRUNCATE will always fail if a foreign key is defined. It's operating at page level, not row level, so has no idea what values are in individual rows and hence whether deleting them would break a foreign key constraint. Therefore it disallows the operation regardless of the data.

  • Now we got the point I think.

    --------------------------------------
    ;-)“Everything has beauty, but not everyone sees it.” ― Confucius

  • or

    Drop table BBB

    Presume question author made a mistake in sintax, main reason why majority did not accept the answer 'D' as correct solution.

    ~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*~*Brevity is the soul of wit.

  • Same here, immediately discounted d) as the TSQL was incorrect.

  • chgn01 (3/12/2015)


    Now we got the point I think.

    There is no point in writing incorrect syntax & then marking it as correct answer.


    Sujeet Singh

  • d can not be the answer as it is having syntax error. Only correct answer is f.

    If you run the statement it gives the below error:

    Msg 156, Level 15, State 1, Line 1

    Incorrect syntax near the keyword 'table'.

  • I'm going back over old questions I missed. This question is one that I am dealing with a lot lately. It had good info. Thanks.

Viewing 7 posts - 46 through 51 (of 51 total)

You must be logged in to reply to this topic. Login to reply