Sunday, February 19, 2012

How to set "0" instead of blank spaces to a column or field.

Hi i hv a doubt in Sql server reporting..I do generate some reports based on some criteria.In the results screen i hv empty fields based on the search i hv generated.I need to set "0" instead of blank spaces in the fields..Can any one help me?

What about using either using SQL Server logic to tranform the data or use reporting services to encapsulate the logic

CASE LEN(LTRIM(RTRIM(SomeColumn))) WHEN 0 THEN 0 ELSE SomeColumn END

would be the SQL Server alternative

Jens K. Suessmeyer

http://www.sqlserver2005.de

|||I do use a select query from a view in my .rdl file.While selecting i need to set "0" to some columns which ever is null.Will it works?|||

CASE LEN(LTRIM(RTRIM(ISNULL(SomeColumn,'')))) WHEN 0 THEN 0 ELSE SomeColumn END

Jens K. Suessmeyer

http://www.sqlserver2005.de

No comments:

Post a Comment