
November 10th, 2003, 09:28 AM
|
 |
Digitally Challenged
|
|
Join Date: May 2003
Posts: 280
Time spent in forums: 54 m 14 sec
Reputation Power: 6
|
|
|
cursors and stored procs
looking for some help on a stored procedure. here is what i have. it is supposed to insert the unique values from an existing table into a new table. should be 40, but instead it continually puts in blank values and won't stop. so here's the proc.
Code:
CREATE PROCEDURE sp_filltitletable
AS
declare title_curs cursor for
select title
from employee group by title
for read only
declare @actualtitle varchar(50)
open title_curs
fetch title_curs into @actualtitle
while @@fetch_status = 0
begin
insert into Emp_Title (Title) values (@actualtitle)
end
close title_curs
deallocate title_curs
fugured it out. had the fetch in the wrong spot!
__________________
My brain cells are like a storm trooper's armor: useless
Last edited by don_sparko : November 10th, 2003 at 09:36 AM.
|