Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DATEDIFF puzzle

Status
Not open for further replies.

elmo29

Programmer
Jul 28, 2000
50
GB

I have an internal variable in a stored procedure holding the number of seconds between one number and another

DECLARE @Variable int
SET @variable = DATEDIFF(second, @date1, @date2)

INSERT test(value)VALUES(@variable)

gives me 0, while

INSERT test(value)VALUES(DATEDIFF(second, @date1, @date2))

gives me the correct value

...... why????? :)
[sig][/sig]
 
Probably because the interval is less than 1, and an integer only holds....integers. Try defining the variable and column as decimal(10,4). [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br> [/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top