There are some posts related to this but I\'m so new to TSQL that I cannot make sense of them so please excuse me.
My procedure has:
BEGIN TRY
If you look at the documentation for CONVERT, you'll see that format 102 is the ANSI format, or yyyy.mm.dd
. So passing a date like 2012.05.08
should work.
It looks like 2012.05.08 9:41
and 2012.05.08 9:41AM
will work too, but that's outside the documented format.
Change CONVERT(DATETIME, @mydate, 102)
to CONVERT(DATETIME, @mydate, 100)
or just CONVERT(DATETIME, @mydate)
reference to CAST and CONVERT and http://www.sqlusa.com/bestpractices/datetimeconversion/ on MSDN
Maybe something like this:
EXEC mydbo.dbo.myprocedure @mydate = '2012/05/08 09:21:00'