Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Convert MicroSeconds to seconds

Author  Topic 

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2010-02-03 : 01:29:37
Hi All
I want to convert microseconds in to seconds in SQL Server.
Specifically i want to convert

total_elapsed_time,last_elapsed_time,min_elapsed_time,max_elapsed_time
these columns in seconds from sys.dm_exec_query_stats.
and also want to produce a column like avarage.
Somebody help me out in this

iF theRe iS a wAy iN tHen theRe iS a wAy oUt..

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-03 : 03:46:40
just multiply by POWER(10,6) to convert to seconds
Go to Top of Page

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2010-02-03 : 03:55:55
I think it is divide, not multiply.
I am going wrong or what?


iF theRe iS a wAy iN tHen theRe iS a wAy oUt..
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2010-02-03 : 04:06:53
yes. Divide it by 1000000


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-03 : 04:08:29
quote:
Originally posted by ashishashish

I think it is divide, not multiply.
I am going wrong or what?


iF theRe iS a wAy iN tHen theRe iS a wAy oUt..


micro seconds means second divided by 10^6 so to make it back to second you need to multiply by 10^6
Go to Top of Page

ashishashish
Constraint Violating Yak Guru

408 Posts

Posted - 2010-02-03 : 04:41:55
Hi Vishak sir sorry to interupt you again.. but i think you take it wrong
1 Sec=1000000 Micro Second
So you have to Divide it by 1000000 by change it to again seconds.
Here it is explained

http://www.unitconversion.org/time/seconds-to-microseconds-conversion.html
http://www.unitconversion.org/time/microseconds-to-seconds-conversion.html


iF theRe iS a wAy iN tHen theRe iS a wAy oUt..
Go to Top of Page
   

- Advertisement -