declare @title_id varchar(50)
declare @title varchar(500)
declare democursor cursor
for
select top 10000 C_ID,CompanyName from companyinfo where C_ID not in(select top 3000 C_ID from companyinfo)
open democursor
fetch next from democursor into @title_id,@title
while @@FETCH_STATUS=0
begin
insert into EnterpriseLibrary(Guid,C_ID,FirstSort,SecSort,sort) values(newid(),@title_id,'32D670','693064','F1E2C4')
fetch next from democursor into @title_id,@title
end
close democursor
deallocate democursor