Re: delete tables

From: Dinesh T.K (tkdinesh_at_nospam.mail.tkdinesh.com)
Date: 06/03/04


Date: Thu, 3 Jun 2004 07:13:32 +0530

Lud,

The below query would give the creation date of the tables whose name starts
with RC

SELECT crdate
FROM sysobjects
WHERE type='U'
AND [name] LIKE 'RC%'

You can schedule a sql job which will find the old ones (use DATEDIFF) and
drop them.

--
Dinesh
SQL Server MVP
--
--
SQL Server FAQ at
http://www.tkdinesh.com
"Lud" <anonymous@discussions.microsoft.com> wrote in message
news:9F3258D6-2B18-4899-B137-1D4E73C609BD@microsoft.com...
> Iīm new with SQL. I have a CA product that creates every day 44 tables,
aways with the same name (RCXXXXX). But this program donīt delete this
tables after generate its. I need to delete this tables automatic whent they
became 7 days old. Any one can help?
> Thanks,
>
> Lud


Relevant Pages

  • Re: Index Creation Date
    ... Anith, ... >Join sysindexes and sysobjects and use the crdate in the ... Read details on SQL Server Books Online. ...
    (microsoft.public.sqlserver.security)
  • Re: Table Creation DateTime
    ... If you are using proper permissions in place then from the sysobjects table ... In my production system I can see a user table Create Date got ... > does any of the SQL server operation does change the Create Date of the ... Books Online for SQL Server SP3 at ...
    (microsoft.public.sqlserver.server)
  • Re: OBJECT Level Permissions
    ... Pro SQL Server 2000 Database Design ... > There isn't a generic collection object that would allow you to GRANT EXEC ... > on all procs in a single statement. ... > However you could build a cursor that looks at sysobjects and loops though ...
    (microsoft.public.sqlserver.programming)
  • Re: Drop Column that has a Default value
    ... This fails as the ... default value object is stored in SysObjects. ... DROP CONSTRAINT MyDefault ... If you didn't specify a name for the default, SQL Server will have ...
    (microsoft.public.sqlserver.clients)
  • Re: INFORMATION_SCHEMA ignores defaults?
    ... Sysobjects should only be used if nothing else works:) The less you use ... the less you will have to undo next year when the next version of ... SQL Server comes out. ... "Michael C" wrote in message ...
    (microsoft.public.sqlserver.programming)