我有一个存储过程(SP1),我希望它调用另一个存储过程(SP2)。
代码 SP2
ALTER PROCEDURE dbo.addOrderStatus
(
@orderID INT,
@statusID INT,
@startTime DATETIME,
@endTime DATETIME,
@isActive BIT
)
AS
BEGIN
SET NOCOUNT ON
INSERT INTO Order_Status
(orderID, statusID, startTime, endTime, isActive) VALUES
(@orderID, @statusID, @startTime, @endTime, @isActive)
END
代码 SP1
ALTER PROCEDURE [dbo].addNewOrder
(
@customerID int,
@restaurantID int,
@cost float,
@addressID int,
@ID INT OUTPUT
)
AS
SET NOCOUNT OFF;
INSERT INTO [Order]
([customerID], [restaurantID], [cost], [addressID])
VALUES (@customerID, @restaurantID, @cost, @addressID);
set @ID = @@IDENTITY
EXEC addOrderStatus @ID, @statusID = 1, @startTime = SYSDATETIME , @endTime = NULL, @isActive = TRUE
我的问题
我得到了这个例外
Error converting data type nvarchar to datetime.
我该如何解决?
谢谢提前
在您的回答和评论之后
代码是
DECLARE @startTime DATETIME
SET @startTime = SYSDATETIME
EXEC addOrderStatus @ID, @statusID = 1, @startTime , @endTime = NULL, @isActive = TRUE
现在我知道我必须使用这个表格name , value