I'm trying to create a stored procedure to update a datetime field from 2 input parameters. (The reason it's like this is that I want to enter the start date/time simular to setting an Outlook reminder, where you have a Calendar Selector for the date and a Combo for the Time)
Below is the syntax:
ALTER PROCEDURE dbo.dsp_update_works
SET work_start = CONVERT(nvarchar(50), @work_start_date, 106) + ' ' + CONVERT(nvarchar(50), @work_start_time, 108)
WHERE (work_id = @work_id)
IF @@ERROR <> 0
RAISERROR ('Update Works failed.',18,1)
When I run the sql it works ok. However, when I run it as a Store Procedure it errors with the following error:
Running [dbo].[dsp_update_works] ( @work_id = 2956, @work_start_date = 17/8/06, @work_start_time = 14:00:00 ).
Conversion failed when converting datetime from character string.
No rows affected.
(0 row(s) returned)
Finished running [dbo].[dsp_update_works].
I've tried various alternatives in variables, but with no success, can someone please tell me what I'm doing wrong?