473,472 Members | 2,224 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Delete Guest Owned Tables

8 New Member
I am trying to get guest owned tables deleted from tempdb database if exists and which are created more than 8 or 9 hours ago. Is this possible as a query in sql 2000?



Thanks !
Oct 9 '07 #1
2 1205
iburyak
1,017 Recognized Expert Top Contributor
You can generate script with following statement:


Expand|Select|Wrap|Line Numbers
  1. use tempdb
  2. go
  3. select 'drop table ' + name from tempdb..sysobjects where crdate < dateadd(hh, -9, getdate())

Good Luck.
Oct 9 '07 #2
ck9663
2,878 Recognized Expert Specialist
I am trying to get guest owned tables deleted from tempdb database if exists and which are created more than 8 or 9 hours ago. Is this possible as a query in sql 2000?



Thanks !
this query will give you a list of tables created 8 (and later) hours ago

select * from sysobjects
where uid = 2 and xtype = 'U' and
datediff(hour, crdate, getdate()) > = 8


you can create a cursor based on this query...build your DROP TABLE sql statement in a string using a variable for the name of the object and do an EXEC
Oct 9 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: lawrence | last post by:
I've two scripts, one to upload images, another to delete them. The upload script works fine, but the delete script has permissions trouble. How can PHP not have permission to delete an image it...
4
by: Wade Chy | last post by:
Hi All I am in a situation where I have to grant select privileges on tables owned by a different owner to a specific role. I am logged in as system/sysdba. I have created a new role...
2
by: Ted Ward | last post by:
Hi all. I have MySQL 4.0.18 and phpMyAdmin running on a FreeBSD box. The other day a student told me he logged on to my phpMyAdmin by specifying "guest" as the user and no password. I don't have a...
11
by: mufasa | last post by:
i believe deleting an already delete pointer should give me a segmentation fault! Why, then, is the following working? I am using gcc version 3.0.2. #include<stdio.h> #include <string> using...
6
by: travismorien | last post by:
I hope there is an easy way to do this... I'm doing a database which keeps track of things that people or entities (entities = trusts and companies) own, among other things. When assets are...
7
by: morz | last post by:
i just search for a while in c++ groups but cannot find good answer. i have code like this: int **ptr; ptr = new char *; ptr = new int(5); ptr = new int(16);
4
by: Ignoramus6539 | last post by:
There were some strange requests to my server asking for config.php file (which I do not have in the requested location). I did some investigation. Seems to be a virus written in perl,...
1
by: namewitheldbyrequest | last post by:
Hi, I need a script that I can run from ASP .Net that will delete all views that start with "Search". My site creates them on the fly and they tend to accumulate as more users visit the site. Is...
0
by: gsxr1100 | last post by:
Hi, I've having some baffling problems with a java applicaiton! I have an application server called WA01 which used to access two tables on an MS SQL 2000 server via a scheme login. The two...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.