Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NULL field in SQL Reporting Services

Status
Not open for further replies.

jensays

MIS
Jan 26, 2004
6
0
0
US
I am combining a few fields with expression like ="Entered by: " & Fields!Entered_by.Value & " on " & Fields!date_entered.Value & " " & Fields!comment.Value. Sometimes the Fields contain NULL values, in which case I want to hide the text values. In Crystal I could set it as a formula with IS NOT NULL etc. But how do I do something comparable in SQL RS? Yes, I am being "converted" over from Crystal.
 
IF Fields!Entered_by.Value [highlight]Is Nothing[/highlight] THEN
'The field was null
ELSE
'The field was not null
END IF
 
another option - you can account for NULLS in SQL with the ISNULL function

SELECT X,Y,ISNULL(Z,"Z Is Null") as Z
FROM a,b,c
etc etc

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
You could write the logic into your sql statement instead of handling it on the front end. Just use a case statement.

select case when field1 is null then "do this" else "do this" end field1alias, field2 from table
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top