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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Blank

Author  Topic 

cutiebo2t
Constraint Violating Yak Guru

256 Posts

Posted - 2008-07-19 : 04:45:24
Is blank results (not null) are always on text format? can't it be numberic?

thanks

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-19 : 05:06:06
what do you mean ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

cutiebo2t
Constraint Violating Yak Guru

256 Posts

Posted - 2008-07-19 : 05:09:29
i would like to make blank (' ') results into numeric format instead of text.
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2008-07-19 : 05:25:12
could you use CONVERT

Jack Vamvas
--------------------
Search IT jobs from multiple sources- http://www.ITjobfeed.com
Go to Top of Page

cutiebo2t
Constraint Violating Yak Guru

256 Posts

Posted - 2008-07-19 : 05:29:34
i'm not sure if it's possible
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-19 : 05:31:27
quote:
Originally posted by cutiebo2t

i would like to make blank (' ') results into numeric format instead of text.



case when col = '' then '0' else col end



KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

cutiebo2t
Constraint Violating Yak Guru

256 Posts

Posted - 2008-07-19 : 05:35:11
can you help me with this? i want results to be blank still

COALESCE (NULLIF (STR(SUM(CASE WHEN CCL_maint = 'Yes' THEN 1.0 ELSE 0.0 END) / COUNT(id), 10, 2), '0.00'), '') AS CCL_maint
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-19 : 05:41:05
[code]COALESCE (NULLIF (SUM (CASE WHEN CCL_maint = 'Yes' THEN 1.0 ELSE 0.0 END) / COUNT(id), 0.00), '') AS CCL_maint[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

cutiebo2t
Constraint Violating Yak Guru

256 Posts

Posted - 2008-07-19 : 05:48:02
i'm getting this error message:

Error converting data type varchar to numeric
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-19 : 06:39:38
[code]COALESCE (CONVERT(varchar(10), NULLIF (SUM (CASE WHEN CCL_maint = 'Yes' THEN 1.0 ELSE 0.0 END) / COUNT(id), 0.00)), '') AS CCL_maint[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

cutiebo2t
Constraint Violating Yak Guru

256 Posts

Posted - 2008-07-20 : 19:07:01
so it's in text format, right?
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2008-07-20 : 19:16:29
Yes. And so we have pointed out for you in the last three duplicate topics.


E 12°55'05.25"
N 56°04'39.16"
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-20 : 21:58:47
[code]
COALESCE (CONVERT(sql_variant, NULLIF (SUM (CASE WHEN CCL_maint = 'Yes' THEN 1.0 ELSE 0.0 END) / COUNT(id), 0.00)), '') AS CCL_maint
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-20 : 22:01:04
Why can't you perform the required formatting in your front end application ? It will save you 3 duplicate topics and lots of time


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-07-21 : 03:00:44
quote:
Originally posted by khtan

Why can't you perform the required formatting in your front end application ? It will save you 3 duplicate topics and lots of time


KH
[spoiler]Time is always against us[/spoiler]




I already suggessed to OP on the other thread

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2008-07-21 : 03:03:45
quote:
Originally posted by madhivanan

quote:
Originally posted by khtan

Why can't you perform the required formatting in your front end application ? It will save you 3 duplicate topics and lots of time


KH
[spoiler]Time is always against us[/spoiler]




I already suggessed to OP on the other thread

Madhivanan

Failing to plan is Planning to fail



All the others threads ? Well, you missed out this


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -