Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

Floor Function Expand / Collapse
Posted Thursday, April 24, 2008 11:01 PM


Group: General Forum Members
Last Login: Wednesday, February 20, 2013 3:38 PM
Points: 156, Visits: 417
Comments posted to this topic are about the item Floor Function
Post #490413
Posted Friday, April 25, 2008 7:29 AM



Group: General Forum Members
Last Login: 2 days ago @ 9:16 AM
Points: 2,941, Visits: 3,704
select floor(13.890) returns 13, but just for fun, here are the results for a couple of variations in SQL 2000 (one difference from SQL 2005 is shown):

select floor('13.890')
(SQL 2005 returns 13, without the trailing .0.)

select floor("13.890")
Server: Msg 207, Level 16, State 3, Line 1
Invalid column name '13.890'.

I thought select floor('13.890') would return an error, but it looks like SQL Server does an implicit conversion from text to number type in order to allow the calculation.


"I love spending twice as long and working twice as hard to get half as much done!" – Nobody ever.

"Operator! Give me the number for 911!" - Homer Simpson

"A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'"
Post #490647
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse