L
liuguilg
Unregistered / Unconfirmed
GUEST, unregistred user!
表t2
s1 char(10), s2 char(10)
我想通过s1来查询出s1,s2
代码是这样的
create procedure t2_select
@s1 char(10)
as
create table #temp_t2
{
ss1 char(10),
ss2 char(10)
}
declare @s_s1 char(10)
declare @s_s2 char(10)
DECLARE CURSOR_t2 CURSOR For select * from t2
where s1=@s1
open CURSOR_t2
fetch next from CURSOR_t2 into @s_s1,@s_s2
WHILE (@@FETCH_STATUS = 0)
begin
insert into #temp_t2(ss1,ss2) values (@s_s1,@s_s2)
FETCH NEXT FROM CURSOR_t2 into @s_s1,@s_s2
end
CLOSE CURSOR_t2
DEALLOCATE CURSOR_t2
select * from #temp_t2
drop table #temp_t2
go
错误是这样的
[Microsoft][ODBC SQL Server Driver]Syntax error or access violation
s1 char(10), s2 char(10)
我想通过s1来查询出s1,s2
代码是这样的
create procedure t2_select
@s1 char(10)
as
create table #temp_t2
{
ss1 char(10),
ss2 char(10)
}
declare @s_s1 char(10)
declare @s_s2 char(10)
DECLARE CURSOR_t2 CURSOR For select * from t2
where s1=@s1
open CURSOR_t2
fetch next from CURSOR_t2 into @s_s1,@s_s2
WHILE (@@FETCH_STATUS = 0)
begin
insert into #temp_t2(ss1,ss2) values (@s_s1,@s_s2)
FETCH NEXT FROM CURSOR_t2 into @s_s1,@s_s2
end
CLOSE CURSOR_t2
DEALLOCATE CURSOR_t2
select * from #temp_t2
drop table #temp_t2
go
错误是这样的
[Microsoft][ODBC SQL Server Driver]Syntax error or access violation