Have tried using CAST and CONVERT unsuccessfully, keep getting the same error 'syntax error converting datetime from a character string'.
I am passing dates between a trigger to a stored procedure. The dates are being passed as nvarchar and are converted to a string char(20) in the input parameters of the procedure. If I set the input parameter instead to a datetime it fails the conversion at the input parameter and gives a slightly different error.
I tested the input and they are in the format { FEB 13, 2005 12:00AM } but I just don't seem able to convert them after being passed into the procedure. E.g. { CONVERT(datetime, @date, 103) } or { CAST(@date as datetime) }. I have tried using { SET DATEFORMAT dmy }, but this makes no difference either.
Any ideas? ps sorry I haven't included the code as I am at home, will try and update this later.
I am passing dates between a trigger to a stored procedure. The dates are being passed as nvarchar and are converted to a string char(20) in the input parameters of the procedure. If I set the input parameter instead to a datetime it fails the conversion at the input parameter and gives a slightly different error.
I tested the input and they are in the format { FEB 13, 2005 12:00AM } but I just don't seem able to convert them after being passed into the procedure. E.g. { CONVERT(datetime, @date, 103) } or { CAST(@date as datetime) }. I have tried using { SET DATEFORMAT dmy }, but this makes no difference either.
Any ideas? ps sorry I haven't included the code as I am at home, will try and update this later.