Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 ssrs 2008 r2 parameters
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Constraint Violating Yak Guru

332 Posts

Posted - 12/20/2013 :  09:57:51  Show Profile  Reply with Quote
In an existing SSRS 2008 R2 report, I need to add some extra parameters to several reports that call subreports. There will be times when the parameters may be empty. The visibility of specific columns and report headers will determine if the column or report header will be displayed. If the parameter(s) are empty, null, do not contain anything, I want those columns and report headerts to not display.

Can you show me the code that will test to see if a parameter value is null?

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 12/21/2013 :  01:34:41  Show Profile  Reply with Quote
Didnt i give you solution here?

SQL Server MVP
Go to Top of Page

Starting Member

3 Posts

Posted - 12/22/2013 :  13:50:15  Show Profile  Reply with Quote
Hi I have tried using the mv_param function and the fn_split function, When I use them it returns everything from that column, my example follows...When executed it returns everything like it is ignoring the function, @Country prints out the right values as set in the param, but the results are 'USA,IRL,AUS,NZL,CAN,JPN' I am at a loss because the function isn't working so it seems. The function code follows the select code....Any help or advise is greatly appreciated.

>DECLARE @currYr nvarchar(4)
DECLARE @gblCliName nvarchar(65)
DECLARE @Country nvarchar(75)

SET @currYr ='2013'
SET @gblCliName ='Jimmy'
SET @Country ='CAN,AUS,IRL'

AND SUBSTRING(MONTH_CODE, 1, 4) = @currYr AND AON_COUNTRY IN (select AON_COUNTRY from dbo.fnSplit(@Country,',')as string)

ALTER FUNCTION [dbo].[fnSplit]
( @string nvarchar(4000)
, @delim nvarchar(100) )
@result TABLE
( [Value] nvarchar(4000) NOT NULL
, [Index] int NOT NULL )
DECLARE @str nvarchar(4000)
, @pos int
, @prv int = 1

SELECT @pos = CHARINDEX(@delim, @string)
WHILE @pos > 0
SELECT @str = SUBSTRING(@string, @prv, @pos - @prv)
INSERT INTO @result SELECT @str, @prv

SELECT @prv = @pos + LEN(@delim)
, @pos = CHARINDEX(@delim, @string, @pos + 1)

INSERT INTO @result SELECT SUBSTRING(@string, @prv, 4000), @prv
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000