Thursday, February 16, 2012

[ask] sqlserver getdate() function doesnt return seconds value

i have a quite strange condition...

when i add some value in database with getdate() function it only returns date and minute not the seconds...

does somebody have an experience about this

What is the data type of the variable or column that you are using? If it is smaldatetime, the accuracy is only of minutes. If you want seconds, you'll need to use datetime.

If you're doing something else, post your code to see if we can help you figure it out.

Don

|||

getdate() actually returns current date & time. Just try to select getdate() and you will see. You must have assign the value of getdate() to smalldatetime.|||

I've changed to datetime and it works :)

weew... i never thought about it... just a little mistake there :)

thx anyway

No comments:

Post a Comment