March 15, 2006 at 9:42 am
Haven't tested this, but try:
SELECT 'Address' =
CASE WHEN address2 IS NULL
THEN address1
ELSE address2
END
FROM tablename
John
March 15, 2006 at 9:46 am
... or, even better:
SELECT COALESCE(address2, address1)
FROM tablename
March 15, 2006 at 10:07 am
I am ok with my select statement, i got the result i need but when when i add this select to my expression in my report its not working. not sure if i am adding it in right way to my expression in report.
Thanks!
March 15, 2006 at 10:38 am
OK, I see from your thread on SQL-Server-Performance that your problem is that only the first row of the result set is displayed in your app. If you say what you're using to design your app and provide the code that is connecting to the database and running the query then I'm sure someone will be able to help you. I'm afraid it's not my area, though.
John
March 15, 2006 at 10:42 am
what do u mean by app, I am doing these in my sql server reporting services.
March 15, 2006 at 4:47 pm
=IIF(fields!address2.value = '',fields!address1.value,fields!address2)
Moe C
March 16, 2006 at 8:41 am
I ran into this same problem. SSRS allows functions in the text box (like Moe's IIF example). But if you have a large nested IIF function, it can get really ugly. If you want to use a case statement, you have to create it in a custom function in the code window in Report Proerties. You can then call the code from the textbox using the code member (Code.YourFunctionName()).
March 16, 2006 at 3:57 pm
Why not add the CASE Statement to your Stored Procedure data source and just return it to the report as a field... might wotk better...
Martin
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply