6> CREATE TABLE works_on (emp_no INTEGER NOT NULL,
7> project_no CHAR(4) NOT NULL,
8> job CHAR (15) NULL,
9> enter_date DATETIME NULL)
10> GO
1>
2>
3> declare @i integer, @j integer
4> declare @job char(20), @enter_date datetime
5> declare @project_no char(4)
6> declare @dept_no char(4)
7> set @i = 1
8> set @j = 1
9> set @job = 'Analyst'
10> set @enter_date = GETDATE()
11> set @dept_no = 'd1'
12> while @i < 3001
13> begin
14> while @j < 5
15> begin
16> if (@j = 1) set @dept_no = 'd1'
17> else if (@j = 2) set @dept_no = 'd2'
18> else if (@j = 3) set @dept_no = 'd3'
19> else set @dept_no = 'd4'
20> insert into works_on
21> values (@i, @dept_no, @job, @enter_date)
22> set @j = @j+1
23> end
24> set @i = @i+1
25> set @j = 1
26> end
27> GO
(1 rows affected)
(1 rows affected)
(1 rows affected)
(1 rows affected)
(1 rows affected)
(1 rows affected)
(1 rows affected)