I have a stored procedure (SP1), I want it to call another stored procedure(SP2).
Code 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
Code 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
My problem
I got this exception
Error converting data type nvarchar to datetime.
How could I solve it ?
Thanks advance
after your answers and comments
the code is
DECLARE @startTime DATETIME
SET @startTime = SYSDATETIME
EXEC addOrderStatus @ID, @statusID = 1, @startTime , @endTime = NULL, @isActive = TRUE
now I got that I have to use this form name , value