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 |
|
JMOE
Starting Member
4 Posts |
Posted - 2011-05-01 : 19:08:29
|
| Hello All.Have a connection string that I use to pull data into an excel table.The issue I have is that one column (hours)is exporting as general but need it to come down as decimalI have tried to cast and convert, as well as *1.0 but it will not work.The column (hours) properties are nvarchar 255,nullAnd have both single char and decimals54.758.5SELECT Convert(decimal(18,2), hours)*1.0 as hoursFROM [dbLookups].[dbo].[TTDATA]full join dblookups.dbo.tblcolhierarchyon empid = empidHow do I format it in my query so it will automatically come down as decimal?Thanks |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-05-01 : 21:39:15
|
try convert the result to stringselect convert(varchar(20), convert(decimal(18,2), hours))from . . . KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|