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 |
|
dr_seusse
Starting Member
22 Posts |
Posted - 2002-07-23 : 08:55:39
|
I'm trying to truncate some numbers in a view.Is seems like it is not possible to use functions such as stuff, round, len...etc in a view.How do I get around this?I'm trying to do something like the following:select x=stuff(round(number, 3), len(x)-3, 4,'') thanks |
|
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2002-07-23 : 09:13:03
|
| You're using STUFF, which is a string function, on a numeric expression returned by ROUND. You're also trying to do the same thing with LEN. Try this:SELECT Stuff(Cast(Round(number, 3) as varchar), Len(Cast(x as varchar))-3, 4, '')Ummmm...why don't you just use CONVERT?SELECT Convert(number, decimal(15, 2))Or STR?SELECT STR(number, 15, 2) |
 |
|
|
|
|
|
|
|