October 14, 2013 at 5:16 am
Hi,In below query I want to pass the parameter whose datatype is Datatime,dynamically,
I am getting following error,
Conversion failed when converting date and/or time from character string.
Declare @P_AsonDate as datetime = Getdate(),@Str_ToDo As varchar(1000)
Set @Str_ToDo = ''
Set @Str_ToDo = 'SpTable_2mail' + ' ' + @P_AsonDate
Print @Str_ToDo
EXEC (@Str_ToDo )
Please help me,
This is urgent to me.
October 14, 2013 at 5:56 am
avdhut.k (10/14/2013)
Hi,In below query I want to pass the parameter whose datatype is Datatime,dynamically,I am getting following error,
Conversion failed when converting date and/or time from character string.
Declare @P_AsonDate as datetime = Getdate(),@Str_ToDo As varchar(1000)
Set @Str_ToDo = ''
Set @Str_ToDo = 'SpTable_2mail' + ' ' + @P_AsonDate
Print @Str_ToDo
EXEC (@Str_ToDo )
Please help me,
This is urgent to me.
Best way is just like Sean posted...
On your post you need to close the quote marks after date and also need to convert the datetime to a string format with date format..
CREATE PROCEDURE SpTable_2mail @Date DATETIME
AS
SELECT @date
GO
DECLARE @P_AsonDate as datetime = Getdate(),@Str_ToDo As varchar(1000)
Set @Str_ToDo = ''
Set @Str_ToDo = 'SpTable_2mail ''' + CONVERT(VARCHAR(100),@P_AsonDate , 109) + ''''
Print @Str_ToDo
EXEC (@Str_ToDo )
October 15, 2013 at 11:35 pm
Thanks!!!!!!!!!!!!
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply