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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Place characters left of decimal in separate field 1

Status
Not open for further replies.

noslo

Programmer
Dec 10, 2001
24
0
0
US
Hello Wise Ones,

How do I code a new column in SQL 2000 which selects all the numbers to the left of a decimal point in another column? The numbers vary from 1.0 to 19999.99

Thanks
 
You can use the FLOOR() SQL function.

As per BOL:
Returns the largest integer less than or equal to the given numeric expression.

Jim
 
It sounds like you want to have what is known as a computer column in your table. Using jaustin's suggestion of FLOOR(), you would do:

alter table MyTable
add MyNewCol AS (FLOOR(OtherCol))
 
Thanks for your response BPerry. I appreciate your helpfulness. I'll give it a try.

Helen Tip: Never fry bacon without a shirt on.
 
Yikes, I had a dumb typo in my earlier response.

That's a computed column, not computeR column.
Also known as a calculated column.

Sorry about that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top