Solved

GetDate Seconds

Posted on 2006-10-24
3
2,395 Views
Last Modified: 2008-01-09
I am using GetDate() as a default in a table item

Strangely it seems to round the time down to the minute..

ie

2006-10-24 20:53:00
 
How do I get it to accurately state seconds?
0
Comment
Question by:MaximusMeridus
3 Comments
 
LVL 9

Accepted Solution

by:
gpompe earned 500 total points
ID: 17799388
Probably the field is smalldatetime. Change to datetime and done.
0
 
LVL 42

Expert Comment

by:EugeneZ
ID: 17799405
use datetime instead of smalldatetime

select cast(getdate() as smalldatetime),getdate()

result:
2006-10-24 17:04:00         2006-10-24 17:04:10.217
0
 
LVL 15

Expert Comment

by:DonKronos
ID: 17799406
If the column is defined as "smalldatetime" then the accuracy will only be to minutes.  You need a data type of "datetime" to get seconds and milliseconds.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Viewers will learn how the fundamental information of how to create a table.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now