Remove data from tables

  • Toreador


    Points: 11251

    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.

  • chgn01

    Hall of Fame

    Points: 3664

    Now we got the point I think.

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

  • AlexMcCo


    Points: 2759


    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.

  • Jeff_C

    Old Hand

    Points: 319

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

  • Divine Flame


    Points: 15941

    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

  • bamshankar2004

    SSC Eights!

    Points: 848

    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'.

  • akljfhnlaflkj

    SSC Guru

    Points: 76202

    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 52 (of 52 total)

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