• I don't have code for creating the database. As I indicated previously, I didn't create the thing, I just get stuck cleaning it up when the end user does something unforeseen.

    This is code from a backup script, but it assumes the database already exists and is working with individual tables. When I try to use it to create a table, it runs with no errors, but I can't find the table anywhere.

    What you posted is great for the table Archives. Unfortunately this table was not mentioned in your original post. I think you want to delete rows 3 other tables and far as I can tell this Archives tables has nothing to do with it.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/