I have the following piece of SQL that does not work:
declare @id INT;
set @id=0;
exec insert_mail @id OUTPUT, 'ZLgeOZlqRGC6l57TyD/xYQ==', 4928, '2010\01\14\14\03131_2.eml', 'Suz, Katie and Kourtney''s Housewarming Party', CONVERT(DATETIME, '2015-01-18 14:03:13', 120);
select @id;
and changing it this way fixes it:
declare @id INT;
set @id=0;
declare @p_valid_until datetime;
set @p_valid_until=CONVERT(DATETIME, '2015-01-18 14:03:13', 120)
exec insert_mail @id OUTPUT, 'ZLgeOZlqRGC6l57TyD/xYQ==', 4928, '2010\01\14\14\03131_2.eml', 'Suz, Katie and Kourtney''s Housewarming Party', @p_valid_until;
select @id;
Anybody can explain?
Cheers,
Jan
In the first case you are calling the CONVERT function in an execute command which is not allowed. You can’t call functions in the passing of arguments
I don’t see the point of using the convert function. Just type date in without convert.