Creating a recycle bin for SQL Server 2005\2008

  • Comments posted to this topic are about the item Creating a recycle bin for SQL Server 2005\2008

  • Yea great idea, and very nice post here Chris!

    This one is enable in Oracle from 10g version if I'm not wrong!

    Anyway, thanks for the script and explanation!

    😎

    ============================================================
    SELECT YOUR PROBLEM FROM SSC.com WHERE PROBLEM DESCRIPTION =
    http://www.sqlservercentral.com/articles/Best+Practices/61537/[/url]

  • Good post! Interesting concept!

  • Chris,

    This is the reason I subscribe to the forums. One becomes a "panner for gold" or a "hunter of diamonds". And, this is a find that I think I will have to frame somewhere amongst my piles of debris left over from my adventures surfing the net.

    I must send you a million thanks. This article and associated code have introduced a much needed breath of fresh air in my cubicle.

    Thanks,

    Duncan

  • very good post....this is the thing i was really expected when i was beginner in sql 2005..........anyway a good idea and i appreciate to share this valuable information to everyone.............................:-)

  • Interesting, but what if someone renames a procedure, object or view ?

  • Nice article, Chris!

    Now we have an un-drop. Last things we need are un-delete and un-update. 😀

    (I know about auditing tables ;-))

  • What a great idea. Thank you for the tip. I did have one question. Are there any additional considerations for items that are schema bound or have foreign keys associated to them?

  • Duncan Ray could not have said it better.... "gold", "diamonds", "debris", " breath of fresh air".

    Thanks a million.

    -Mike

  • Interesting article and great concept. I've always relied on backups if an object gets dropped accidentally but this would be an interesting concept. I'm wondering why you didn't do it as database instead of schemas? A little more work, but I think it would work also.

  • doveb (5/20/2009)


    What a great idea. Thank you for the tip. I did have one question. Are there any additional considerations for items that are schema bound or have foreign keys associated to them?

    You can't drop the parent table in a foreign key relationship, but you can drop the child.

    You can't drop a table that has a schema-bound view associated with it.

    Here's some tests:

    CREATE TABLE parent

    (

    Id INT PRIMARY Key

    )

    GO

    CREATE TABLE child

    (

    id INT,

    parent_id INT REFERENCES parent(id)

    )

    GO

    -- will not work because it is the parent table

    DROP TABLE parent;

    GO

    -- you can drop the child table

    DROP TABLE child;

    GO

    CREATE TABLE child

    (

    id INT,

    parent_id INT REFERENCES parent(id)

    )

    GO

    CREATE VIEW vw_child

    WITH SCHEMABINDING

    AS

    SELECT id, parent_id FROM dbo.child

    GO

    -- can't drop the table if there is schema bound view

    DROP TABLE child;

    Go

  • Fantastic idea, thanks.

  • "Excellent Script By Chris Kinley".

    A Special Thanks goes to Steve & SQL Guru like {Gail, Jeff & others} for posting this kind of article in the forum which specify the future technologies of SQL Server.

    Cheers!

    Sandy.

    --

  • Superb idea

  • Very handy! Good job, here.

    Thanks for sharing

    Lee

Viewing 15 posts - 1 through 15 (of 30 total)

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