Re: Milliseconds to SQL Server DateTime



Vitt wrote:
For the moment, you can use a data types Float, where a day is equivalent to one unit, similar to the data types DateTime

Test:

Create table test(D1 DateTime, D2 Float);
insert into Test (D1, D2) values(now, now);
select D1, D2, cast(D2 as DateTime) from Test;

I've tried that also, but for some reason, when I am using parameters, I get the same value to the database with every insert, even if I update the parameter... I am trying to find out what I need to do to refresh the param value. Quite strange...

.



Relevant Pages

  • Re: Audit table, finding first change for each item
    ... The cast on aud_dt and aud_tm are because both are datetime, ... This query gives me the desired results but I just want the first change ... cast((cast(b.aud_dt as float) + cast) as datetime) ... Earlier versions of SQL Server: ...
    (comp.databases.ms-sqlserver)
  • Re: UDF and SQL2000 - Why doesnt this work?
    ... assignment to the @DailyVal variable is the problem. ... loop actually works when I return a datetime and only update the date. ... DECLARE @TempDate datetime ... DECLARE @TempVal float ...
    (microsoft.public.sqlserver.programming)
  • Re: How to write date transform script
    ... even locale safe. ... It will take care of creating a datetime that will work with the ... > YYYYMMDD and the following columns are floating point numbers. ... > POpen float ...
    (microsoft.public.sqlserver.clients)
  • Re: UDF and SQL2000 - Why doesnt this work?
    ... Basically This is what I want to do - I have created a query ... > datetime, @PeriodEnd datetime) ... > DECLARE @TempDate datetime ... > DECLARE @TempVal float ...
    (microsoft.public.sqlserver.programming)
  • Re: Wrapping T-SQL in Function and it gets very slow.
    ... I have a SELECT statement that manipulate a datetime: ... GROUP BY CAST(ROUND(CAST(DischargeEventTime AS float), 0, 1) AS datetime) ... AS TimeValue FROM tblItemData WHERE DischargeEventTime between ... Why does "wrapping" SQL in a function cost so much?!? ...
    (comp.databases.ms-sqlserver)