Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-08-31 : 07:15:35
|
Deepa writes "We have trunc function in oracle for truncating Number and Date values.I want a user defined function to mimic the same functionality in SQL server." |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2005-08-31 : 07:17:13
|
You don't need a UDF for it:SELECT convert(int, num_value) --for numbersSELECT DateAdd(day, DateDiff(day, 0, date_value), 0) --for dates |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-31 : 07:19:49
|
For numbers you can use Round function (also Floor, ceiling)For dates use Convert functionMadhivananFailing to plan is Planning to fail |
|
|
|
|
|