存储过程出错 急??????????
我在sql2000写了一个存储过程,利用游标取一个text类型的字段值,语法没错但在查询分析器执行时报错,提示varbinary和text类型不匹配,不能转换,服务器: 消息 206,级别 16,状态 2,过程 sp_enterprise_advice,行 55
Operand type clash: varbinary is incompatible with text
不知为何?存储过程如下:
CREATE PROCEDURE sp_enterprise_advice ( --企业建议
@enterp_code varchar(10),
@question_date datetime)
as
declare @blatitude_code varchar(10),
@blatitude_name varchar(50),
@blatitude_mark decimal(12,3),
@blatitude_advice varbinary(16),
@min_score decimal(12,3),
@max_score decimal(12,3),
@blatitude_value varchar(10)
CREATE TABLE #LATITUDE_CONTENT_TEMP(
ENTERP_CODE VARCHAR(10) not null,
QUESTION_DATE DATETIME not null,
LATITUDE_CODE VARCHAR(10) not null,
LATITUDE_NAME VARCHAR(50) null,
LATITUDE_MARK DECIMAL(12,3) null,
LATITUDE_ADVICE TEXT null,
LATITUDE_VALUE VARCHAR(10) null,
TYPE_NAMES VARCHAR(10) NULL)
begin
select @min_score = min_score ,@max_score =
max_score from t_latgradestandard where enterp_code = @enterp_code
DECLARE latitude_advice_cursor CURSOR FOR
select blatitude_code,blatitude_name,blatitude_mark from
t_big_latitude_statistic where enterp_code = @enterp_code and
question_date = @question_date and blatitude_mark < @min_score
order by blatitude_code
OPEN latitude_advice_cursor
FETCH NEXT FROM latitude_advice_cursor
INTO @blatitude_code,@blatitude_name,@blatitude_mark
WHILE @@fetch_status = 0
BEGIN
select @blatitude_advice = TEXTPTR(advice_content) from
t_advice where enterp_code = @enterp_code and latitude_code =@blatitude_code
READTEXT t_advice.advice_content @blatitude_advice 0 0
insert into #LATITUDE_CONTENT_TEMP(
ENTERP_CODE,
QUESTION_DATE,
LATITUDE_CODE,
LATITUDE_NAME,
LATITUDE_MARK,
LATITUDE_ADVICE,
LATITUDE_VALUE,
TYPE_NAMES)
values( @enterp_code,
@question_date,
@blatitude_code,
@blatitude_name,
@blatitude_mark,
@blatitude_advice,
@blatitude_value,
'大纬度')
FETCH NEXT FROM latitude_advice_cursor
INTO @blatitude_code,@blatitude_name,@blatitude_mark
end
close latitude_advice_cursor
deallocate latitude_advice_cursor
select * from #LATITUDE_CONTENT_TEMP
end
GO
表结构如下:
create table t_advice
( enterp_code varchar(10) not null,
latitude_code varchar(10) not null,
latitude_name varchar(50) null,
remark varchar(50) null ,
advice_content text null ,
constraint PK_t_advice primary key clustered (enterp_code, latitude_code)
)请大虾们帮忙看看,指点一下