获取存储过程中每个项的id的简单方法

时间:2013-10-27 16:21:28

标签: sql-server stored-procedures

我有一个像这样的存储过程:

alter procedure [dbo].[PDTCarDetails]
@carid nvarchar(100)=null,
@plateSource nvarchar(100)=null,
@platecode nvarchar(100)=null,
@plateNumber nvarchar(100)=null,
@parkingType nvarchar(100)=null,
@amount integer=null,
@driverId nvarchar(100)=null,
@cmpl bit=null,
@self bit=null,
@cmplname nvarchar(100)=null,
@remarks nvarchar(100)=null,
@make nvarchar(100)=null,
@model nvarchar(100)=null,
@color nvarchar(100)=null,
@carlocation nvarchar(100)=null,
@comments nvarchar(100)=null

as 
begin
SET NOCOUNT ON;
declare @Psid integer,@pcDid integer,@vtype integer,@cmplid integer,@mkid integer,@mdlid integer,
@clrid integer
select @psid= ps.PSID from PlateSource_tbl ps where ps.PS=@plateSource
select @pcDid= pc.PCdID from  PlateCode_tbl pc where pc.PlateCode=@platecode
select @vtype= v.vtid from VType_tbl v where v.Vtype=@parkingType
select @cmplid= c.CmplID from Complimentary_tbl c where c.CompName=@cmplname
select @mkid= m.mkid from  Make_tbl m where m.Make=@make
select @mdlid= md.mdlid from Model_tbl md where md.Model=@model
select @clrid= cl.colid from Color_tbl cl where cl.Colname=@color
end

首先,我接受每个值后,我正在采取每个值的特定id 有没有办法用比这个存储过程更短的同样的事情(我的意思是任何其他简单的方法来获取我的存储过程中每个项目的特定id)

0 个答案:

没有答案