Board index » delphi » Milliseconds removed from a DATETIME parameter to a SQL7 stored procedure

Milliseconds removed from a DATETIME parameter to a SQL7 stored procedure

Hi,
I am passing a DATETIME parameter to a SQL7 Server stored procedure and it
appears that the value is begin rounded - no milliseconds are passed to SQL
server.

e.g. I select the field and can get it's complete value, but when I pass the
same
value into a stored procedure as a parameter it gets to SQL7 server with no
milliseconds and hence the query fails.
The code uses variants and all displays of the value once formatted with
formatdatetime include the millisecond data.

Help? Ideas anybody?
Losing hairs real fast ...

Thanks.
Myles Penlington.

 

Re:Milliseconds removed from a DATETIME parameter to a SQL7 stored procedure


I'm not able to reproduce this problem.  When I use the following code:

create proc test (@param1 datetime) as
select @param1

declare @test datetime
select @test = getdate()
select @test

exec test @test

...both times the @test variable prints out with the milliseconds.
Perhaps you could include some sample code that reproduces your problem.

Sylvia

In article <8cel0p$k...@bornews.borland.com>,
  "Myles Penlington" <my...@ams.co.nz-removethispart> wrote:

Quote
> Hi,
> I am passing a DATETIME parameter to a SQL7 Server stored procedure
and it
> appears that the value is begin rounded - no milliseconds are passed
to SQL
> server.

> e.g. I select the field and can get it's complete value, but when I
pass the
> same
> value into a stored procedure as a parameter it gets to SQL7 server
with no
> milliseconds and hence the query fails.
> The code uses variants and all displays of the value once formatted
with
> formatdatetime include the millisecond data.

> Help? Ideas anybody?
> Losing hairs real fast ...

> Thanks.
> Myles Penlington.

Sent via Deja.com http://www.deja.com/
Before you buy.

Re:Milliseconds removed from a DATETIME parameter to a SQL7 stored procedure


Myles,

I don't know if this bears on your problem, but we had a related issue when
moving from SQLSvr 6.5 to SQLSvr 7 and using ODBC. The SQLBindParameter
routine now requires the 'ColumnSize' argument to have a value of 23, not 16
(the size of a date/time structure) as before. This is documented in a MS
knowledge base article. If 16 is passed as the length, the ODBC driver
truncates everything after the seconds in the time. We experienced different
symptoms to you ("Datetime field overflow") but it is possible that the
problems are related?

Regards,
Danny Mavromatis.

Quote
Myles Penlington wrote in message <8cel0p$k...@bornews.borland.com>...
>Hi,
>I am passing a DATETIME parameter to a SQL7 Server stored procedure and it
>appears that the value is begin rounded - no milliseconds are passed to SQL
>server.

>e.g. I select the field and can get it's complete value, but when I pass
the
>same
>value into a stored procedure as a parameter it gets to SQL7 server with no
>milliseconds and hence the query fails.

>The code uses variants and all displays of the value once formatted with
>formatdatetime include the millisecond data.

>Help? Ideas anybody?
>Losing hairs real fast ...

>Thanks.
>Myles Penlington.

Other Threads