日期:2014-05-17 浏览次数:20909 次
CREATE PROCEDURE Proc_tbTareSelectAll
-- Add the parameters for the stored procedure here
@strWhere nvarchar(255)=null
AS
BEGIN
DECLARE @sql NVARCHAR(500)
SET @sql = 'SELECT [TareID] as 序号
,[CarID] as 车号
,[StationID] as 站点
,[TARE] as 皮重
,[TRWID] as 任务号
,[TareLu] as 路数
,[TareStated] as 皮重状态
,[TaredSetCount] as 设定次数
,[TaredCount] as 实过次数
,[Tmemos] as 备注
FROM [OneWeight].[CarScale].[tbTare]
where ' + @strWhere --比如@strwhere 内容是 tarelu='20'
EXEC(@sql)
END
CREATE PROCEDURE Proc_tbTareSelectAll
-- Add the parameters for the stored procedure here
@strWhere nvarchar(255)=null
AS
DECLARE @sql NVARCHAR(max)
SET @sql='SELECT [TareID] as 序号
,[CarID] as 车号
,[StationID] as 站点
,[TARE] as 皮重
,[TRWID] as 任务号
,[TareLu] as 路数
,[TareStated] as 皮重状态
,[TaredSetCount] as 设定次数
,[TaredCount] as 实过次数
,[Tmemos] as 备注
FROM [OneWeight].[CarScale].[tbTare]
where '+ @strWhere --这个地方怎么写呢
EXEC (@sql)
go