--try:
ALTER PROCEDURE [dbo].[GetRDTData_020] @PlantNr char(4),
@EngineNr tinyint,
@Language char(3),
@TIME1 VARCHAR(30),
@TIME2 VARCHAR(30)
AS
BEGIN declare @uidFldEngineID as uniqueidentifier
declare @Text as varchar(20)
set @Text='vcFldMsgText'+@Language
exec (
'select DateTime, ms, Nr, '+@Text+' MessageText, Type
from View_Data4020
where uidFldEngineID = (select uidFldEngineID
from View_EID4020
where cFldPlantNr='''+@PlantNr+'''
and convert(char(2),tiFldEngineNr)='''+ltrim(@EngineNr)+''' ) '
) END
@EngineNr tinyint,
@Language char(3)='',
@TIME1 VARCHAR(30)='',
@TIME2 VARCHAR(30)=''
AS
BEGIN declare @uidFldEngineID as uniqueidentifier
declare @Text as varchar(20)
set @Text='vcFldMsgText'+isnull(@Language,'')
exec (
'select DateTime, ms, Nr, '+isnull(@Text,'')+' MessageText, Type
from View_Data4020
where uidFldEngineID = (select uidFldEngineID
from View_EID4020
where cFldPlantNr='''+@PlantNr+'''
and convert(char(2),tiFldEngineNr)='''+@EngineNr+''' ) '
)
END
ALTER PROCEDURE [dbo].[GetRDTData_020] @PlantNr char(4),
@EngineNr tinyint,
@Language char(3)='',
@TIME1 VARCHAR(30)='',
@TIME2 VARCHAR(30)=''
AS
BEGIN declare @uidFldEngineID as uniqueidentifier
declare @Text as varchar(20)
set @Text='vcFldMsgText'+isnull(@Language,'')
exec (
'select DateTime, ms, Nr, '+@Text+' MessageText, Type
from View_Data4020
where uidFldEngineID = (select uidFldEngineID
from View_EID4020
where cFldPlantNr='''+@PlantNr+'''
and convert(char(2),tiFldEngineNr)='''+@EngineNr+''' ) '
)
END+@Text+MessageText是一个字段?
也就是这样才出问题了。
我觉得是where子句里面的条件,本来数据库中是存在符合条件的记录的,但是这里却找不到,头疼!
然后在查询分析器里执行这个存储过程看看print出来的sql语句.