For some reason a stored procedure which I have created is incorrectly
saving the date to the table. It seems the day and month are being
swapped around e.g. a date which should be the 12th April (12/04/2005)
is saving as the 4th December (04/12/2005).
The parameter used in the stored procedure comes from a VB6 app, I
amended this so the format was "yyyymmdd hh:mm:ss". The full line in VB
being,
Parameters.Append .CreateParameter("date_of_call", adChar, , 17,
Format(firstCallDateTime, "yyyymmdd hh:mm:ss"))
When I run my VB app it works fine, the syntax in the stored procedure
is,
CREATE PROCEDURE dbo.spUpdValues
@data_id int,
@date_of_call datetime
as
update data
SET date_of_call = CONVERT(char, @date_of_call, 101)
where data_id=@data_id
Is it because the convert format is using an american date format ? I
can't see why as I can't reproduce this error using my own PC as the
date saves correctly, I can also confirm it's not happening to everybody
who uses the app. If it is happening for specifc users then what could
be the cause. I've checked Regional Settings and all seems fine there.
Any ideas on what could be doing this as I'm struggling to investigate
any further.
To debug I ran the stored procedure direct, manually inputting the
variable - again no problem. Also, the following SQL statment shows no
problem...
declare @date_of_call datetime
set @date_of_call = '20041101 08:30:00'
select CONVERT(char, @date_of_call, 101)
select CONVERT(char, @date_of_call, 106)
------------------------------
11/01/2004
(1 row(s) affected)
------------------------------
01 Nov 2004
(1 row(s) affected)
Any help would be much appreciated.
*** Sent via Developersdex
http://www.developersdex.com ***