0
Im使用MS SQL,並有一段代碼需要多個基本SP來運行我想要做的是將它們壓縮到一個。在SP中選擇多個返回一個記錄集
ALTER PROCEDURE SP_JOB_IMPORT_MULTICALL
(
@driverid as int,
@vehicleid as int,
@place as nvarchar(50)
)
AS
DECLARE @imval as int
BEGIN
SET @imval = (SELECT ad.ImportValue FROM Admin AS ad WHERE ad.ID=1) +1
END
BEGIN
SELECT DriverID,[JM ID] FROM Drivers WHERE [email protected]
SELECT [Unit ID],[External JM ID] FROM Vehicles WHERE [Unit ID] = @VehicleID
SELECT ImportValue FROM admin WHERE ID=1
SELECT Dwelltime FROM Places WHERE Placename = @place
SELECT [JM External ID] FROM Places WHERE Placename = @place
END
UPDATE ADMIN SET ImportValue = @IMVAL WHERE ID=1
RETURN
我怎麼能做到這一點,並返回它作爲一個記錄集即
驅動ID,JM ID,組ID,外部JM ID,進口額,停留時間,JM外部ID
1 ------------ 1 -------- 1 -------- 1 ----------------- --- 1 ----------------- 1 -------------- 1
@ user3652973。 。 。我誤解了這一點。我的意思是一行(和一行)。 – 2014-12-04 13:21:19
非常感謝 – user3652973 2014-12-04 13:22:40
@GordonLinoff我很好奇,如果在休息時使用null的聯盟會更好? – brykneval 2014-12-04 13:24:17