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 |
|
noms
Starting Member
22 Posts |
Posted - 2009-02-19 : 04:13:33
|
| hi expertsi have a field called AttributeValue in my database and it's a datatype of varchar, it's stores string values as well as money and number values. i want to limit the selection to only those values which are numbers and money and convert them to floathere's my select statement"SELECT @liImpairment = CAST(AV.[AttributeValue] AS float)*(1-(@DeprPds/@liRUL)), @liFairValue = CAST(AV.[AttributeValue] AS float(1))-@liImpairmentFROM [stdAttributeValues] AV"but i'm getting an error "Error converting data type varchar to float." |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-02-19 : 04:22:00
|
| Add thisWHERE AV.[AttributeValue] not like '%[^0-9.]%'MadhivananFailing to plan is Planning to fail |
 |
|
|
noms
Starting Member
22 Posts |
Posted - 2009-02-19 : 04:33:21
|
| you are such a star i'll give you 10 out of 10 |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-02-20 : 02:46:00
|
quote: Originally posted by noms you are such a star i'll give you 10 out of 10
You are welcome MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|