调了一小时了 不知道哪错了。。。。
ALTER PROCEDURE ZYDA__selectRecordByRecordID
@records nvarchar(200),
@type int,
@power int,
@department int,
@id int
as
declare @sql nvarchar(4000)
set @sql='SELECT ZYDA_Records.id, ZYDA_Records.records_no, ZYDA_Records.superscription, ZYDA_Records.mulu,
ZYDA_Records.remark, ZYDA_Records.quanzong,ZYDA_Records.type,ZYDA_FileType.type
FROM ZYDA_Records INNER JOIN
ZYDA_FileType ON ZYDA_Records.type = ZYDA_FileType.id where (1=1) '
-- 如果只有类型 没有案卷 仅搜索类型
if( @type <> '0')
set @sql=@sql+' and ( ZYDA_Records.type like ''%'+@type+'%'')'
like''%'+@records+'%'')'
exec(@sql)
显示错误:
正在运行 [dbo].[ZYDA__selectRecordByRecordID] ( @records = , @type = 102, @power = 1, @department = 1, @id = 1 ).
将 nvarchar 值 'SELECT ZYDA_Records.id, ZYDA_Records.records_no, ZYDA_Records.superscription, ZYDA_Records.mulu,
ZYDA_Records.remark, ZYDA_Records.quanzong,ZYDA_Records.type,ZYDA_FileType.type
FROM ZYDA_Records INNER JOIN
ZYDA_FileType ON ZYDA_Records.type = ZYDA_FileType.id where (1=1) and ( ZYDA_Records.type like '%' 转换为数据类型为 int 的列时发生语法错误。
没有行受影响。
...全文


