2> CREATE TABLE myusers(
3> UserID varchar(30)NOT NULL PRIMARY KEY,
4> FirstName varchar(30),
5> LastName varchar(30),
6> EmployeeType char(1) NOT NULL,
7> DBAccess varchar(30),
8> StartDate datetime,
9> ExpDate datetime
10> )
11> GO
1>
2> CREATE PROC pr_deluser (@TD datetime )
3> AS
4> DELETE syslogins WHERE name IN(SELECT UserID FROM myusers WHERE EmployeeType = "C" and ExpDate <= @TD)
5> GO
1>
2> drop proc pr_deluser;
3> GO
1>
2> drop table myusers;
3> GO
|