Why am I getting this error for a SP calling another SP. If I call the SP directory it works just fine.
Msg 257, Level 16, State 3, Procedure TEST1, Line 25
Implicit conversion from data type datetime to int is not allowed. Use the CONVERT function to run this query.
SP1 -> SP
ALTER PROCEDURE [TEST].[TEST1]
@EventId INT = NULL,
@MemberId INT = NULL,
@Type INT = NULL,
@Scheduled BIT = 0,
@DivisionId INT = NULL,
@DivisionTeamId INT = NULL,
@Date DATETIME = NULL,
@GymCourtId INT = NULL
AS
BEGIN SET NOCOUNT ON; SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
CREATE TABLE #GridGames (
[Id] [int] NOT NULL,
[Number] [int] NULL,
[Round] [int] NULL,
[GameType] [int] NULL,
.
.
.
.
INSERT INTO #GridGames
EXEC [TEST].[TEST] @EventId, @MemberId, @Type, @Scheduled, @DivisionId, @DivisionTeamId, @Date, @GymCourtId
SP
ALTER PROCEDURE [TEST].[TEST]
@EventId INT = NULL,
@MemberId INT = NULL,
@Type INT = NULL,
@Scheduled BIT = 0,
@DivisionId INT = NULL,
@DivisionTeamId INT = NULL,
@Date DATETIME = NULL,
@GymCourtId INT = NULL
AS
BEGIN
DECLARE @DayAhead DATETIME;
IF(@Date IS NOT NULL)
BEGIN
SET @DayAhead = DATEADD (DAY , 1 , @Date);
END
SELECT
game.Id,
game.[Type] AS GameType,
game.[Date],
UPDATE
Line 25 is pointing to game.[Date]
in the nested stored proc, but that is a datetime null type, and my temp table also has that, what gives?
Found out why, it's because my parameter order on the inner SP select statement didnt match the temp table order.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With