use stored proc with dynamic sql for datetime / varchar convert

I have a report where the stored procedure is dynamically created with a datetime parameter.
The date time parameter uses the calendar control and passes the datetime value back to the stored procedure to fetch the records back to the report.
In order to dynamically create the query I need to convert the calendar control datetime format to varchar with the format "mm/dd/yyyy hh:dd:mm"

SELECT @m_strOnDate = UPPER(CONVERT(VARCHAR(19), @dtOnDate, 120))

the desired format is
"MM/DD/YYYY hh:mm:ss"

thank you
JoeUSAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:


SELECT @m_strOnDate = CONVERT(VARCHAR(10), @dtOnDate, 101) + ' ' + convert(varchar(8), @dtOnDate, 8)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.