@@ROWCOUNT when cascade delete?

  • Hi,

    Is there an easy way to see how many rows got affected - both parent and children - when I delete from a parent and there is a cascade delete FK between child and parent?

    In other words,

    if I have table Parent with 1 row

    and table Child with 10 rows that belong to that parent above

    and then I do DELETE from parent, I want to see 11 as a number of rows affected

    Thanks!

  • Afaik, there is no way to get that number back from SQL. In theory, SQL could have had to cascade thru a dozen tables (or more).

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • thanks!

Viewing 3 posts - 1 through 2 (of 2 total)

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