Solved

GetDate Seconds

Posted on 2006-10-24
3
2,398 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

808 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