利用游标导入数据

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
declare @Name varchar(20),@Url varchar(200)
declare cur cursor for select [Name],Url from [TableTemp]
open cur
fetch next from cur into @Name,@Url
while @@fetch_status = 0
begin
Insert into [KeyWords](UserID,[Name],Url,WarningTop,BeginTime,EndTime,Remark)
values(
1,
@Name,
'domain.com',
10,
'2008-11-19',
'2009-12-31',
@Url
)
fetch next from cur into @Name,@Url
end
close cur
deallocate cur