1

Using sql server 2000

Table1

id value (float)

001 10.00
002 
003 
004 08.50
...

i want to check the value column, if is null then display 'NA'

Tried Query

Select id,
CASE WHEN value  IS NULL then '-' else value end  AS value
from table1

'

Select id,
isnull(value, '-') AS value
from table1

Both query showing error as "Error converting data type varchar to float."

How to solve this issue.

need query help

4 Answers 4

3
Select id, 
isnull(convert(varchar(20),value), '-') AS value 
from table1 
Sign up to request clarification or add additional context in comments.

Comments

1

Try

SELECT id, CAST(COALESCE(value, 'NA') as VARCHAR(25)) as [Value]
FROM tableName

Comments

0

use below query :

SELECT id, ISNULL( CAST(value as VARCHAR(25)), 'NA')) as [Value]
FROM tableName

Comments

0
select id,cast(isnull(value,'') as varchar(10)) from table

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.