Showing posts with label parameters. Show all posts
Showing posts with label parameters. Show all posts

Friday, February 24, 2012

allows blank value for integer Parameter

Hi have a problem to solve and I hope that this is not a SSRS Bug.

I created a Reports(using SQL Server Project) which has several parameters which values are passed to a SP.

One of these parameter is an Integer and it is an optional value, so if the user fill it is used by the SP, otherwise the SP uses NULL and run anyway.

I starts to define tha parameter:

Datatype = integer

Allow blank value

Available: Non queried

Default: Null

if I want to Preview the report I have to provide an integer to the parameter's field ...

If for instance I set:

Default: Not queried = 0

In the moment I deploy and I use the ReportViewer in my window application the parameter's field is unabled!!

So I tried this solution:

Datatype = integer

Allow blank value

Allow null value

Available: Non queried

Default: Null

In the preview the checkbox: NULL is checked and I click on the View Report.

But when I deploy it,in the ReportViewer in my window application the parameter's field this checkbox is unchecked.

Do I forget something during my setting?I have to control it programmatically?

N.B. By default the user will not user this parameter so the best is that he can click directly on "View Report" without any additional "work" on the parameter!!

Thank you for any help!

hi,

On the report parameters form do this please:

Add a parameter, name it to something,

choose data type integer,

mask as checked the "Allow null value",

select null as default value.

It was working on that way on my box as you wished. I'm using SSRS 2005 wih SP2

Regards,

Janos

Sunday, February 19, 2012

Allowing parameters to be used inside IN cluase

Are there any plans to allow this in future versions of sql server?
e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)
This is currently allowed. What problem are you having?
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
..
"Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com> wrote
in message news:OPBw7IFaEHA.3244@.TK2MSFTNGP12.phx.gbl...
Are there any plans to allow this in future versions of sql server?
e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)
|||It's already there:
create table #tempin(anint int)
go
insert #tempin values(1)
insert #tempin values(2)
go
declare @.int1 int
declare @.int2 int
set @.int1 = 1
set @.int2 = 2
select * from #tempin
where anint in (@.int1, @.int2)
go
"Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com> wrote
in message news:OPBw7IFaEHA.3244@.TK2MSFTNGP12.phx.gbl...
> Are there any plans to allow this in future versions of sql server?
> e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)
>
|||My bad, misunderstood what my sql admin told me.
"Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com> wrote
in message news:OPBw7IFaEHA.3244@.TK2MSFTNGP12.phx.gbl...
> Are there any plans to allow this in future versions of sql server?
> e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)
>
|||He probably meant:
DECLARE @.ids VARCHAR(255)
SET @.ids = '1, 2, 4, 5, 6'
SELECT id FROM table WHERE id IN (@.ids)
See http://www.aspfaq.com/2248
http://www.aspfaq.com/
(Reverse address to reply.)
"Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com> wrote
in message news:uOoo6bFaEHA.3692@.TK2MSFTNGP09.phx.gbl...
> My bad, misunderstood what my sql admin told me.
> "Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com>
wrote
> in message news:OPBw7IFaEHA.3244@.TK2MSFTNGP12.phx.gbl...
>

Allowing parameters to be used inside IN cluase

Are there any plans to allow this in future versions of sql server?
e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)This is currently allowed. What problem are you having?
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
.
"Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com> wrote
in message news:OPBw7IFaEHA.3244@.TK2MSFTNGP12.phx.gbl...
Are there any plans to allow this in future versions of sql server?
e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)|||It's already there:
create table #tempin(anint int)
go
insert #tempin values(1)
insert #tempin values(2)
go
declare @.int1 int
declare @.int2 int
set @.int1 = 1
set @.int2 = 2
select * from #tempin
where anint in (@.int1, @.int2)
go
"Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com> wrote
in message news:OPBw7IFaEHA.3244@.TK2MSFTNGP12.phx.gbl...
> Are there any plans to allow this in future versions of sql server?
> e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)
>|||My bad, misunderstood what my sql admin told me.
"Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com> wrote
in message news:OPBw7IFaEHA.3244@.TK2MSFTNGP12.phx.gbl...
> Are there any plans to allow this in future versions of sql server?
> e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)
>|||He probably meant:
DECLARE @.ids VARCHAR(255)
SET @.ids = '1, 2, 4, 5, 6'
SELECT id FROM table WHERE id IN (@.ids)
See http://www.aspfaq.com/2248
http://www.aspfaq.com/
(Reverse address to reply.)
"Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com> wrote
in message news:uOoo6bFaEHA.3692@.TK2MSFTNGP09.phx.gbl...
> My bad, misunderstood what my sql admin told me.
> "Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com>
wrote
> in message news:OPBw7IFaEHA.3244@.TK2MSFTNGP12.phx.gbl...
>

Allowing parameters to be used inside IN cluase

Are there any plans to allow this in future versions of sql server?
e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)This is currently allowed. What problem are you having?
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
.
"Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com> wrote
in message news:OPBw7IFaEHA.3244@.TK2MSFTNGP12.phx.gbl...
Are there any plans to allow this in future versions of sql server?
e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)|||It's already there:
create table #tempin(anint int)
go
insert #tempin values(1)
insert #tempin values(2)
go
declare @.int1 int
declare @.int2 int
set @.int1 = 1
set @.int2 = 2
select * from #tempin
where anint in (@.int1, @.int2)
go
"Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com> wrote
in message news:OPBw7IFaEHA.3244@.TK2MSFTNGP12.phx.gbl...
> Are there any plans to allow this in future versions of sql server?
> e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)
>|||My bad, misunderstood what my sql admin told me.
"Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com> wrote
in message news:OPBw7IFaEHA.3244@.TK2MSFTNGP12.phx.gbl...
> Are there any plans to allow this in future versions of sql server?
> e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)
>|||He probably meant:
DECLARE @.ids VARCHAR(255)
SET @.ids = '1, 2, 4, 5, 6'
SELECT id FROM table WHERE id IN (@.ids)
See http://www.aspfaq.com/2248
--
http://www.aspfaq.com/
(Reverse address to reply.)
"Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com> wrote
in message news:uOoo6bFaEHA.3692@.TK2MSFTNGP09.phx.gbl...
> My bad, misunderstood what my sql admin told me.
> "Hasani (remove nospam from address)" <hblackwell@.n0sp4m.popstick.com>
wrote
> in message news:OPBw7IFaEHA.3244@.TK2MSFTNGP12.phx.gbl...
> > Are there any plans to allow this in future versions of sql server?
> >
> > e.x.: SELECT * FROM X WHERE Y IN(@.A, @.B, @.C)
> >
> >
>

Thursday, February 16, 2012

Allow null value option in Report Parameters

Hi,
I have very simple parameter driven report that accepts a null value.
When I enable "Allow null value" option under VisualStudio's Report Parameter, the null checkbox is checked by default when I run the report.
Is there anyway that I can uncheck the null check box by default via Visual Studio?
I know I can disable this from Report Property -> Parameter -> Has Default in Report Manager, but I would really like to do this from Visual Studio.
Thank you!You would need to provide a non-null default value for the parameter.
--
This post is provided 'AS IS' with no warranties, and confers no rights. All
rights reserved. Some assembly required. Batteries not included. Your
mileage may vary. Objects in mirror may be closer than they appear. No user
serviceable parts inside. Opening cover voids warranty. Keep out of reach of
children under 3.
"thepacket" <thepacket@.discussions.microsoft.com> wrote in message
news:06A83613-51EF-4A1A-B23F-61AF592AFC81@.microsoft.com...
> Hi,
> I have very simple parameter driven report that accepts a null value.
> When I enable "Allow null value" option under VisualStudio's Report
Parameter, the null checkbox is checked by default when I run the report.
> Is there anyway that I can uncheck the null check box by default via
Visual Studio?
> I know I can disable this from Report Property -> Parameter -> Has Default
in Report Manager, but I would really like to do this from Visual Studio.
> Thank you!
>

Allow Multiple Parameters form Windows Application

I have been working through a solution to allow multiple parameters to be
passed into a SQL RS report. I have created a windows application that calls
sql reporting services. The problem that I am having now is passing the
multiple values the user selects from the dropdown to sql reporting services.
I am setting: returnValues.Value
When I try to set this parameters to 1;2;3, report fails. However, setting
that value to 1 works.
Is this possbile?RS 2000 does not support multiple selections. For instance,
select * from blah where somefield in (@.Param)
will not work. What you can do is use either an expression or call a stored
procedure that takes the parameter and handles appropriately).
This will work:
= "select * from blah where somefield in (" & Parameters!Paramname.value &
")"
Note that this assume you have dealt with putting in all the proper syntax
like single quotes around charater type parameters, etc and that this will
be a valid query when done.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Ms Code Buster" <MsCodeBuster@.discussions.microsoft.com> wrote in message
news:07E56EC7-8D86-492E-A751-199C8E4D8869@.microsoft.com...
>I have been working through a solution to allow multiple parameters to be
> passed into a SQL RS report. I have created a windows application that
> calls
> sql reporting services. The problem that I am having now is passing the
> multiple values the user selects from the dropdown to sql reporting
> services.
>
> I am setting: returnValues.Value
> When I try to set this parameters to 1;2;3, report fails. However,
> setting
> that value to 1 works.
> Is this possbile?|||I have been able to get the mulitple selection parameters to work if I call
the SQL RS report from a web page. I basically created dropdown listboxes
and have the form post to the url of the page I want to run. The multiple
selection values are sent to the report and the report works fine. However,
I am trying to call SQL RS report from a Windows Application. I have my
report created in a way that it uses a stored procedure to parse the multiple
values passed to in and joins to those values from a temp table.
"Bruce L-C [MVP]" wrote:
> RS 2000 does not support multiple selections. For instance,
> select * from blah where somefield in (@.Param)
> will not work. What you can do is use either an expression or call a stored
> procedure that takes the parameter and handles appropriately).
> This will work:
> = "select * from blah where somefield in (" & Parameters!Paramname.value &
> ")"
> Note that this assume you have dealt with putting in all the proper syntax
> like single quotes around charater type parameters, etc and that this will
> be a valid query when done.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
>
> "Ms Code Buster" <MsCodeBuster@.discussions.microsoft.com> wrote in message
> news:07E56EC7-8D86-492E-A751-199C8E4D8869@.microsoft.com...
> >I have been working through a solution to allow multiple parameters to be
> > passed into a SQL RS report. I have created a windows application that
> > calls
> > sql reporting services. The problem that I am having now is passing the
> > multiple values the user selects from the dropdown to sql reporting
> > services.
> >
> >
> > I am setting: returnValues.Value
> >
> > When I try to set this parameters to 1;2;3, report fails. However,
> > setting
> > that value to 1 works.
> >
> > Is this possbile?
>
>|||OK, so you are doing the stored procedure method. That a good way to do it.
This whole thing work if from a web page passing in the multiple selections,
the only difference is that you are doing this from a windows app?
How are you integrating your windows app? URL integration or web services?
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Ms Code Buster" <MsCodeBuster@.discussions.microsoft.com> wrote in message
news:89FA2276-2654-40C1-B03C-EFE7F1B5D0F9@.microsoft.com...
>I have been able to get the mulitple selection parameters to work if I call
> the SQL RS report from a web page. I basically created dropdown listboxes
> and have the form post to the url of the page I want to run. The multiple
> selection values are sent to the report and the report works fine.
> However,
> I am trying to call SQL RS report from a Windows Application. I have my
> report created in a way that it uses a stored procedure to parse the
> multiple
> values passed to in and joins to those values from a temp table.
> "Bruce L-C [MVP]" wrote:
>> RS 2000 does not support multiple selections. For instance,
>> select * from blah where somefield in (@.Param)
>> will not work. What you can do is use either an expression or call a
>> stored
>> procedure that takes the parameter and handles appropriately).
>> This will work:
>> = "select * from blah where somefield in (" & Parameters!Paramname.value
>> &
>> ")"
>> Note that this assume you have dealt with putting in all the proper
>> syntax
>> like single quotes around charater type parameters, etc and that this
>> will
>> be a valid query when done.
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>>
>> "Ms Code Buster" <MsCodeBuster@.discussions.microsoft.com> wrote in
>> message
>> news:07E56EC7-8D86-492E-A751-199C8E4D8869@.microsoft.com...
>> >I have been working through a solution to allow multiple parameters to
>> >be
>> > passed into a SQL RS report. I have created a windows application that
>> > calls
>> > sql reporting services. The problem that I am having now is passing
>> > the
>> > multiple values the user selects from the dropdown to sql reporting
>> > services.
>> >
>> >
>> > I am setting: returnValues.Value
>> >
>> > When I try to set this parameters to 1;2;3, report fails. However,
>> > setting
>> > that value to 1 works.
>> >
>> > Is this possbile?
>>|||I actually need the ability to write the report to a file or display the
report in a web browser on the screen. In both cases I have to set the
Parameter values using an array.
"Bruce L-C [MVP]" wrote:
> OK, so you are doing the stored procedure method. That a good way to do it.
> This whole thing work if from a web page passing in the multiple selections,
> the only difference is that you are doing this from a windows app?
> How are you integrating your windows app? URL integration or web services?
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
>
> "Ms Code Buster" <MsCodeBuster@.discussions.microsoft.com> wrote in message
> news:89FA2276-2654-40C1-B03C-EFE7F1B5D0F9@.microsoft.com...
> >I have been able to get the mulitple selection parameters to work if I call
> > the SQL RS report from a web page. I basically created dropdown listboxes
> > and have the form post to the url of the page I want to run. The multiple
> > selection values are sent to the report and the report works fine.
> > However,
> > I am trying to call SQL RS report from a Windows Application. I have my
> > report created in a way that it uses a stored procedure to parse the
> > multiple
> > values passed to in and joins to those values from a temp table.
> >
> > "Bruce L-C [MVP]" wrote:
> >
> >> RS 2000 does not support multiple selections. For instance,
> >> select * from blah where somefield in (@.Param)
> >>
> >> will not work. What you can do is use either an expression or call a
> >> stored
> >> procedure that takes the parameter and handles appropriately).
> >>
> >> This will work:
> >>
> >> = "select * from blah where somefield in (" & Parameters!Paramname.value
> >> &
> >> ")"
> >>
> >> Note that this assume you have dealt with putting in all the proper
> >> syntax
> >> like single quotes around charater type parameters, etc and that this
> >> will
> >> be a valid query when done.
> >>
> >>
> >> --
> >> Bruce Loehle-Conger
> >> MVP SQL Server Reporting Services
> >>
> >>
> >>
> >> "Ms Code Buster" <MsCodeBuster@.discussions.microsoft.com> wrote in
> >> message
> >> news:07E56EC7-8D86-492E-A751-199C8E4D8869@.microsoft.com...
> >> >I have been working through a solution to allow multiple parameters to
> >> >be
> >> > passed into a SQL RS report. I have created a windows application that
> >> > calls
> >> > sql reporting services. The problem that I am having now is passing
> >> > the
> >> > multiple values the user selects from the dropdown to sql reporting
> >> > services.
> >> >
> >> >
> >> > I am setting: returnValues.Value
> >> >
> >> > When I try to set this parameters to 1;2;3, report fails. However,
> >> > setting
> >> > that value to 1 works.
> >> >
> >> > Is this possbile?
> >>
> >>
> >>
>
>|||What I was trying to clarify is what does and does not work.
It sounds like calling the report from a web page using URL integration does
work. But, you are trying to use web services from your windows app (as an
alternative you can embed an IE control and use URL integration). Since you
say that a single value selected work, I wonder if some seperator character
is causing a problem. In your windows app try having a textbox that you key
in the correct value and see if that works.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"Ms Code Buster" <MsCodeBuster@.discussions.microsoft.com> wrote in message
news:A07E6166-50E6-44D8-8ED4-3E3C279EAB1E@.microsoft.com...
>I actually need the ability to write the report to a file or display the
> report in a web browser on the screen. In both cases I have to set the
> Parameter values using an array.
> "Bruce L-C [MVP]" wrote:
>> OK, so you are doing the stored procedure method. That a good way to do
>> it.
>> This whole thing work if from a web page passing in the multiple
>> selections,
>> the only difference is that you are doing this from a windows app?
>> How are you integrating your windows app? URL integration or web
>> services?
>>
>> --
>> Bruce Loehle-Conger
>> MVP SQL Server Reporting Services
>>
>> "Ms Code Buster" <MsCodeBuster@.discussions.microsoft.com> wrote in
>> message
>> news:89FA2276-2654-40C1-B03C-EFE7F1B5D0F9@.microsoft.com...
>> >I have been able to get the mulitple selection parameters to work if I
>> >call
>> > the SQL RS report from a web page. I basically created dropdown
>> > listboxes
>> > and have the form post to the url of the page I want to run. The
>> > multiple
>> > selection values are sent to the report and the report works fine.
>> > However,
>> > I am trying to call SQL RS report from a Windows Application. I have
>> > my
>> > report created in a way that it uses a stored procedure to parse the
>> > multiple
>> > values passed to in and joins to those values from a temp table.
>> >
>> > "Bruce L-C [MVP]" wrote:
>> >
>> >> RS 2000 does not support multiple selections. For instance,
>> >> select * from blah where somefield in (@.Param)
>> >>
>> >> will not work. What you can do is use either an expression or call a
>> >> stored
>> >> procedure that takes the parameter and handles appropriately).
>> >>
>> >> This will work:
>> >>
>> >> = "select * from blah where somefield in (" &
>> >> Parameters!Paramname.value
>> >> &
>> >> ")"
>> >>
>> >> Note that this assume you have dealt with putting in all the proper
>> >> syntax
>> >> like single quotes around charater type parameters, etc and that this
>> >> will
>> >> be a valid query when done.
>> >>
>> >>
>> >> --
>> >> Bruce Loehle-Conger
>> >> MVP SQL Server Reporting Services
>> >>
>> >>
>> >>
>> >> "Ms Code Buster" <MsCodeBuster@.discussions.microsoft.com> wrote in
>> >> message
>> >> news:07E56EC7-8D86-492E-A751-199C8E4D8869@.microsoft.com...
>> >> >I have been working through a solution to allow multiple parameters
>> >> >to
>> >> >be
>> >> > passed into a SQL RS report. I have created a windows application
>> >> > that
>> >> > calls
>> >> > sql reporting services. The problem that I am having now is passing
>> >> > the
>> >> > multiple values the user selects from the dropdown to sql reporting
>> >> > services.
>> >> >
>> >> >
>> >> > I am setting: returnValues.Value
>> >> >
>> >> > When I try to set this parameters to 1;2;3, report fails. However,
>> >> > setting
>> >> > that value to 1 works.
>> >> >
>> >> > Is this possbile?
>> >>
>> >>
>> >>
>>

Monday, February 13, 2012

Allow Any Date in SP Parameter

I have an SP that includes a date as one of the input parameters. In some
instances I would like to accept any date. Is there a way to set a data
parameter to "any"? I tried playing with '%' but no luck there.
WayneRe-read your question Wayne and see if you understand what you mean.
Isn't "any date" still a date?
Do you mean a default value for a parameter?
"Wayne Wengert" <wayneDONTWANTSPAM@.wengert.com> wrote in message
news:u2l$$epEFHA.1408@.TK2MSFTNGP10.phx.gbl...
> I have an SP that includes a date as one of the input parameters. In some
> instances I would like to accept any date. Is there a way to set a data
> parameter to "any"? I tried playing with '%' but no luck there.
> Wayne
>|||Hi,
You should put NULL as input parameter and check it inside your statment
Ex. WHERE data1 = COALESCE(@.data, data1)
"Wayne Wengert" wrote:

> I have an SP that includes a date as one of the input parameters. In some
> instances I would like to accept any date. Is there a way to set a data
> parameter to "any"? I tried playing with '%' but no luck there.
> Wayne
>
>|||On Mon, 14 Feb 2005 06:18:47 -0700, Wayne Wengert wrote:

>I have an SP that includes a date as one of the input parameters. In some
>instances I would like to accept any date. Is there a way to set a data
>parameter to "any"? I tried playing with '%' but no luck there.
Hi Wayne,
Maybe this web site has some useful idea for you:
http://www.sommarskog.se/dyn-search.html
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Sorry I wasn't clear...
I want the query inside the SP, which uses that data parameter value as one
of the "WHERE" clauses, to accept all records, no matter what date is in the
record. For example, if the Select statement inside the SP is something
like...
SELECT CustomerID, CustomerName FROM Customers WHERE PurchaseDate =
@.dateparameter
I suspect I'll need to use some dummy date like '1/1/1900' and when the date
parameter has that value, just leave that part of the WHERE clause out.
Wayne
"raydan" <rdanjou@.savantsoftNOSPAM.com> wrote in message
news:%23BF3UqpEFHA.3244@.TK2MSFTNGP15.phx.gbl...
> Re-read your question Wayne and see if you understand what you mean.
> Isn't "any date" still a date?
> Do you mean a default value for a parameter?
> "Wayne Wengert" <wayneDONTWANTSPAM@.wengert.com> wrote in message
> news:u2l$$epEFHA.1408@.TK2MSFTNGP10.phx.gbl...
some
>|||Thanks - that is probably what I'll do
Wayne
"Tomasz Borawski" <TomaszBorawski@.discussions.microsoft.com> wrote in
message news:24CE82C5-2B9A-4B61-BF91-C7E2F21B232D@.microsoft.com...
> Hi,
> You should put NULL as input parameter and check it inside your statment
> Ex. WHERE data1 = COALESCE(@.data, data1)
> "Wayne Wengert" wrote:
>
some|||Very nice resource - thanks
Wayne
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
news:9sa111datfaa5r7g45p8ft0blhmg6amune@.
4ax.com...
> On Mon, 14 Feb 2005 06:18:47 -0700, Wayne Wengert wrote:
>
> Hi Wayne,
> Maybe this web site has some useful idea for you:
> http://www.sommarskog.se/dyn-search.html
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)

Sunday, February 12, 2012

ALL STORED PROCS RETURNING NOTHING BUT NULLS IN OUTPUT PARAMETERS

I think my hosting company changed something on SQL Server, but I don't
know what. Suddenly, all OUTPUT parameters from ANY SPROC return NULL.
The funny thing is, the values are in the variables within the SPROCS
(see the PRINT results on the SPROC example below) The behavior is the
same in Query Analyzer as in ADO.Net.
Any help would be GREATLY appreciated.
Thanks,
Brad
Here is some detail:
Stored Proc Definition
=====================================
ALTER PROC DBO.USP_GET_POOL_INFO
@.POOLID INT
,@.PRIVATE CHAR(1) OUTPUT
,@.PLAYERLIMIT NVARCHAR(33) OUTPUT
,@.PLAYERCOUNT INT OUTPUT
AS
SELECT
@.PRIVATE = private
,@.PLAYERLIMIT = CASE WHEN p.player_limit = 0 OR p.player_limit IS
NULL THEN 'No Limit' ELSE CAST(p.player_limit AS NVARCHAR(33)) END
,@.PLAYERCOUNT = ISNULL(pc.player_count,'')
from
tPools p
LEFT OUTER JOIN
(
SELECT
POOLID,
COUNT(*) player_count
FROM
tProfilePool
GROUP BY
POOLID
) pc
ON
p.pool_id = pc.poolid
where
pool_id = @.POOLID
PRINT @.PRIVATE
PRINT @.PLAYERLIMIT
PRINT @.PLAYERCOUNT
========================================
====
Stored Proc Execution:
========================================
====
DECLARE @.PLAYERLIMIT NVARCHAR(33)
DECLARE @.PLAYERCOUNT INT
DECLARE @.PRIVATE CHAR(1)
EXEC DBO.USP_GET_POOL_INFO 2, @.PRIVATE, @.PLAYERLIMIT, @.PLAYERCOUNT
SELeCT @.PRIVATE, @.PLAYERLIMIT, @.PLAYERCOUNT
Result:
NULL NULL NULL
Messages Result (from the PRINT command):
Y
No Limit
1
========================================
Raw TSQL Approach:
========================================
====
DECLARE @.PRIVATE CHAR(1)
DECLARE @.PLAYERLIMIT VARCHAR(33)
DECLARE @.PLAYERCOUNT INT
SELECT
@.PRIVATE = private
,@.PLAYERLIMIT = CASE WHEN p.player_limit = 0 OR p.player_limit IS
NULL THEN 'No Limit' ELSE CAST(p.player_limit AS NVARCHAR(33)) END
,@.PLAYERCOUNT = ISNULL(pc.player_count,'')
from
tPools p
LEFT OUTER JOIN
(
SELECT
POOLID,
COUNT(*) player_count
FROM
tProfilePool
GROUP BY
POOLID
) pc
ON
p.pool_id = pc.poolid
where
pool_id = 2
SELECT
@.PRIVATE, @.PLAYERLIMIT, @.PLAYERCOUNT
========================================
Execution Result:
Y No Limit 1You need to specify OUTPUT in the EXEC
EXEC DBO.USP_GET_POOL_INFO 2, @.PRIVATE OUTPUT , @.PLAYERLIMIT OUTPUT ,
@.PLAYERCOUNT OUTPUT

All parameters as default

Using SSRS 2000, I want to be able to have all the results displayed as
default rather than a specific value set for default before the user clicks
on choosing a specific parameter value.
Is this possible?
Thanks for any suggestions!If what you want to do is use default parameter values and hide their
values from the user then open the Report Parameters dialogue box in
report designer and remove any values from the Prompt window. This
will cause the parameters to not display.|||Thank you for your reponse!
I actually want the user to be able to see and choose the parameters, but I
want the default to be all possible values and not one value for the cases
where they don't want to limit the results.
"toolman" wrote:
> If what you want to do is use default parameter values and hide their
> values from the user then open the Report Parameters dialogue box in
> report designer and remove any values from the Prompt window. This
> will cause the parameters to not display.
>|||I have on occasion provided an "ALL" option to my parameter and set the
default parameter to "ALL".
In SQL, the parameter list is loaded from a dataset as
SELECT <FieldName> AS OutName FROM <TableName>
UNION ALL
SELECT "All" AS OutName FROM <TableName>
In my data dataset the code becomes:
SELECT...
FROM ...
WHERE <DataFieldName> = @.param1 or @.param1 = 'All'
"SK" wrote:
> Thank you for your reponse!
> I actually want the user to be able to see and choose the parameters, but I
> want the default to be all possible values and not one value for the cases
> where they don't want to limit the results.
> "toolman" wrote:
> > If what you want to do is use default parameter values and hide their
> > values from the user then open the Report Parameters dialogue box in
> > report designer and remove any values from the Prompt window. This
> > will cause the parameters to not display.
> >
> >|||Thank you very much William, for responding!
I think this is exactly what I was looking for!
I created a stored procedure in SQL Server and it works fine in the data
tab. When I run it the "Define Query Parameters" dialog box comes up and I
put 'All' and it works fine, giving me all the values. The problem is when I
preview it, it gives me only one value. I've put 'All' as the default under
the report parameter so I'm not sure what's wrong exactly!
"William" wrote:
> I have on occasion provided an "ALL" option to my parameter and set the
> default parameter to "ALL".
> In SQL, the parameter list is loaded from a dataset as
> SELECT <FieldName> AS OutName FROM <TableName>
> UNION ALL
> SELECT "All" AS OutName FROM <TableName>
> In my data dataset the code becomes:
> SELECT...
> FROM ...
> WHERE <DataFieldName> = @.param1 or @.param1 = 'All'
>
> "SK" wrote:
> > Thank you for your reponse!
> >
> > I actually want the user to be able to see and choose the parameters, but I
> > want the default to be all possible values and not one value for the cases
> > where they don't want to limit the results.
> >
> > "toolman" wrote:
> >
> > > If what you want to do is use default parameter values and hide their
> > > values from the user then open the Report Parameters dialogue box in
> > > report designer and remove any values from the Prompt window. This
> > > will cause the parameters to not display.
> > >
> > >|||Have you altered your detail dataset to test the parameter for the "All'
option?
SELECT...
FROM ...
WHERE (<DataFieldName> = @.param1 or @.param1 = 'All')
AND ....
"SK" wrote:
> Thank you very much William, for responding!
> I think this is exactly what I was looking for!
> I created a stored procedure in SQL Server and it works fine in the data
> tab. When I run it the "Define Query Parameters" dialog box comes up and I
> put 'All' and it works fine, giving me all the values. The problem is when I
> preview it, it gives me only one value. I've put 'All' as the default under
> the report parameter so I'm not sure what's wrong exactly!
>
> "William" wrote:
> > I have on occasion provided an "ALL" option to my parameter and set the
> > default parameter to "ALL".
> >
> > In SQL, the parameter list is loaded from a dataset as
> >
> > SELECT <FieldName> AS OutName FROM <TableName>
> > UNION ALL
> > SELECT "All" AS OutName FROM <TableName>
> >
> > In my data dataset the code becomes:
> >
> > SELECT...
> > FROM ...
> > WHERE <DataFieldName> = @.param1 or @.param1 = 'All'
> >
> >
> >
> > "SK" wrote:
> >
> > > Thank you for your reponse!
> > >
> > > I actually want the user to be able to see and choose the parameters, but I
> > > want the default to be all possible values and not one value for the cases
> > > where they don't want to limit the results.
> > >
> > > "toolman" wrote:
> > >
> > > > If what you want to do is use default parameter values and hide their
> > > > values from the user then open the Report Parameters dialogue box in
> > > > report designer and remove any values from the Prompt window. This
> > > > will cause the parameters to not display.
> > > >
> > > >|||Yes, I tried it again and it gives me the correct number of records, but they
all have the same values when "All" is chosen. The data tab gives perfect
result, but as I found it often to be the case, the preview does not mirror
the result in the data tab!
"William" wrote:
> Have you altered your detail dataset to test the parameter for the "All'
> option?
> SELECT...
> FROM ...
> WHERE (<DataFieldName> = @.param1 or @.param1 = 'All')
> AND ....
>
> "SK" wrote:
> > Thank you very much William, for responding!
> >
> > I think this is exactly what I was looking for!
> > I created a stored procedure in SQL Server and it works fine in the data
> > tab. When I run it the "Define Query Parameters" dialog box comes up and I
> > put 'All' and it works fine, giving me all the values. The problem is when I
> > preview it, it gives me only one value. I've put 'All' as the default under
> > the report parameter so I'm not sure what's wrong exactly!
> >
> >
> >
> > "William" wrote:
> >
> > > I have on occasion provided an "ALL" option to my parameter and set the
> > > default parameter to "ALL".
> > >
> > > In SQL, the parameter list is loaded from a dataset as
> > >
> > > SELECT <FieldName> AS OutName FROM <TableName>
> > > UNION ALL
> > > SELECT "All" AS OutName FROM <TableName>
> > >
> > > In my data dataset the code becomes:
> > >
> > > SELECT...
> > > FROM ...
> > > WHERE <DataFieldName> = @.param1 or @.param1 = 'All'
> > >
> > >
> > >
> > > "SK" wrote:
> > >
> > > > Thank you for your reponse!
> > > >
> > > > I actually want the user to be able to see and choose the parameters, but I
> > > > want the default to be all possible values and not one value for the cases
> > > > where they don't want to limit the results.
> > > >
> > > > "toolman" wrote:
> > > >
> > > > > If what you want to do is use default parameter values and hide their
> > > > > values from the user then open the Report Parameters dialogue box in
> > > > > report designer and remove any values from the Prompt window. This
> > > > > will cause the parameters to not display.
> > > > >
> > > > >|||The reason it doesn't match is that the preview tab uses cached results
unless the value of the parameters you pick change. So if no parameters or
the parameters don't change then it will use the cached value. Look where
you rdl files are stored. You will see files called reportname.rdl.data,
these files have the cached data used by the preview tab. Delete the file
and it will requery the database.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
"SK" <SK@.discussions.microsoft.com> wrote in message
news:327904F9-F352-4BE7-9887-88AC6F522979@.microsoft.com...
> Yes, I tried it again and it gives me the correct number of records, but
> they
> all have the same values when "All" is chosen. The data tab gives perfect
> result, but as I found it often to be the case, the preview does not
> mirror
> the result in the data tab!
>
> "William" wrote:
>> Have you altered your detail dataset to test the parameter for the "All'
>> option?
>> SELECT...
>> FROM ...
>> WHERE (<DataFieldName> = @.param1 or @.param1 = 'All')
>> AND ....
>>
>> "SK" wrote:
>> > Thank you very much William, for responding!
>> >
>> > I think this is exactly what I was looking for!
>> > I created a stored procedure in SQL Server and it works fine in the
>> > data
>> > tab. When I run it the "Define Query Parameters" dialog box comes up
>> > and I
>> > put 'All' and it works fine, giving me all the values. The problem is
>> > when I
>> > preview it, it gives me only one value. I've put 'All' as the default
>> > under
>> > the report parameter so I'm not sure what's wrong exactly!
>> >
>> >
>> >
>> > "William" wrote:
>> >
>> > > I have on occasion provided an "ALL" option to my parameter and set
>> > > the
>> > > default parameter to "ALL".
>> > >
>> > > In SQL, the parameter list is loaded from a dataset as
>> > >
>> > > SELECT <FieldName> AS OutName FROM <TableName>
>> > > UNION ALL
>> > > SELECT "All" AS OutName FROM <TableName>
>> > >
>> > > In my data dataset the code becomes:
>> > >
>> > > SELECT...
>> > > FROM ...
>> > > WHERE <DataFieldName> = @.param1 or @.param1 = 'All'
>> > >
>> > >
>> > >
>> > > "SK" wrote:
>> > >
>> > > > Thank you for your reponse!
>> > > >
>> > > > I actually want the user to be able to see and choose the
>> > > > parameters, but I
>> > > > want the default to be all possible values and not one value for
>> > > > the cases
>> > > > where they don't want to limit the results.
>> > > >
>> > > > "toolman" wrote:
>> > > >
>> > > > > If what you want to do is use default parameter values and hide
>> > > > > their
>> > > > > values from the user then open the Report Parameters dialogue box
>> > > > > in
>> > > > > report designer and remove any values from the Prompt window.
>> > > > > This
>> > > > > will cause the parameters to not display.
>> > > > >
>> > > > >|||That makes sense, thank you!
But, it still didn't seem to work in this case!
If I use the below in the dataset, I get the all the parameters right, excep
the "All" and
SELECT...
FROM ...
WHERE (<DataFieldName> = @.param1 or @.param1 = 'All')
AND ....
And if I call a stored procedure in the dataset, I get all the values and
not just the parameter value that I choose.
"Bruce L-C [MVP]" wrote:
> The reason it doesn't match is that the preview tab uses cached results
> unless the value of the parameters you pick change. So if no parameters or
> the parameters don't change then it will use the cached value. Look where
> you rdl files are stored. You will see files called reportname.rdl.data,
> these files have the cached data used by the preview tab. Delete the file
> and it will requery the database.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "SK" <SK@.discussions.microsoft.com> wrote in message
> news:327904F9-F352-4BE7-9887-88AC6F522979@.microsoft.com...
> > Yes, I tried it again and it gives me the correct number of records, but
> > they
> > all have the same values when "All" is chosen. The data tab gives perfect
> > result, but as I found it often to be the case, the preview does not
> > mirror
> > the result in the data tab!
> >
> >
> >
> > "William" wrote:
> >
> >> Have you altered your detail dataset to test the parameter for the "All'
> >> option?
> >> SELECT...
> >> FROM ...
> >> WHERE (<DataFieldName> = @.param1 or @.param1 = 'All')
> >> AND ....
> >>
> >>
> >> "SK" wrote:
> >>
> >> > Thank you very much William, for responding!
> >> >
> >> > I think this is exactly what I was looking for!
> >> > I created a stored procedure in SQL Server and it works fine in the
> >> > data
> >> > tab. When I run it the "Define Query Parameters" dialog box comes up
> >> > and I
> >> > put 'All' and it works fine, giving me all the values. The problem is
> >> > when I
> >> > preview it, it gives me only one value. I've put 'All' as the default
> >> > under
> >> > the report parameter so I'm not sure what's wrong exactly!
> >> >
> >> >
> >> >
> >> > "William" wrote:
> >> >
> >> > > I have on occasion provided an "ALL" option to my parameter and set
> >> > > the
> >> > > default parameter to "ALL".
> >> > >
> >> > > In SQL, the parameter list is loaded from a dataset as
> >> > >
> >> > > SELECT <FieldName> AS OutName FROM <TableName>
> >> > > UNION ALL
> >> > > SELECT "All" AS OutName FROM <TableName>
> >> > >
> >> > > In my data dataset the code becomes:
> >> > >
> >> > > SELECT...
> >> > > FROM ...
> >> > > WHERE <DataFieldName> = @.param1 or @.param1 = 'All'
> >> > >
> >> > >
> >> > >
> >> > > "SK" wrote:
> >> > >
> >> > > > Thank you for your reponse!
> >> > > >
> >> > > > I actually want the user to be able to see and choose the
> >> > > > parameters, but I
> >> > > > want the default to be all possible values and not one value for
> >> > > > the cases
> >> > > > where they don't want to limit the results.
> >> > > >
> >> > > > "toolman" wrote:
> >> > > >
> >> > > > > If what you want to do is use default parameter values and hide
> >> > > > > their
> >> > > > > values from the user then open the Report Parameters dialogue box
> >> > > > > in
> >> > > > > report designer and remove any values from the Prompt window.
> >> > > > > This
> >> > > > > will cause the parameters to not display.
> >> > > > >
> >> > > > >
>
>|||I am trying the same thing the problem is that I need to do this for
several different fields. If I select "all", all the records show. But
when I change one to something other then "All" I get zero records
shown..
Randy
--
Bruce L-C [MVP] wrote:
> The reason it doesn't match is that the preview tab uses cached results
> unless the value of the parameters you pick change. So if no parameters or
> the parameters don't change then it will use the cached value. Look where
> you rdl files are stored. You will see files called reportname.rdl.data,
> these files have the cached data used by the preview tab. Delete the file
> and it will requery the database.
>
> --
> Bruce Loehle-Conger
> MVP SQL Server Reporting Services
> "SK" <SK@.discussions.microsoft.com> wrote in message
> news:327904F9-F352-4BE7-9887-88AC6F522979@.microsoft.com...
> > Yes, I tried it again and it gives me the correct number of records, but
> > they
> > all have the same values when "All" is chosen. The data tab gives perfect
> > result, but as I found it often to be the case, the preview does not
> > mirror
> > the result in the data tab!
> >
> >
> >
> > "William" wrote:
> >
> >> Have you altered your detail dataset to test the parameter for the "All'
> >> option?
> >> SELECT...
> >> FROM ...
> >> WHERE (<DataFieldName> = @.param1 or @.param1 = 'All')
> >> AND ....
> >>
> >>
> >> "SK" wrote:
> >>
> >> > Thank you very much William, for responding!
> >> >
> >> > I think this is exactly what I was looking for!
> >> > I created a stored procedure in SQL Server and it works fine in the
> >> > data
> >> > tab. When I run it the "Define Query Parameters" dialog box comes up
> >> > and I
> >> > put 'All' and it works fine, giving me all the values. The problem is
> >> > when I
> >> > preview it, it gives me only one value. I've put 'All' as the default
> >> > under
> >> > the report parameter so I'm not sure what's wrong exactly!
> >> >
> >> >
> >> >
> >> > "William" wrote:
> >> >
> >> > > I have on occasion provided an "ALL" option to my parameter and set
> >> > > the
> >> > > default parameter to "ALL".
> >> > >
> >> > > In SQL, the parameter list is loaded from a dataset as
> >> > >
> >> > > SELECT <FieldName> AS OutName FROM <TableName>
> >> > > UNION ALL
> >> > > SELECT "All" AS OutName FROM <TableName>
> >> > >
> >> > > In my data dataset the code becomes:
> >> > >
> >> > > SELECT...
> >> > > FROM ...
> >> > > WHERE <DataFieldName> = @.param1 or @.param1 = 'All'
> >> > >
> >> > >
> >> > >
> >> > > "SK" wrote:
> >> > >
> >> > > > Thank you for your reponse!
> >> > > >
> >> > > > I actually want the user to be able to see and choose the
> >> > > > parameters, but I
> >> > > > want the default to be all possible values and not one value for
> >> > > > the cases
> >> > > > where they don't want to limit the results.
> >> > > >
> >> > > > "toolman" wrote:
> >> > > >
> >> > > > > If what you want to do is use default parameter values and hide
> >> > > > > their
> >> > > > > values from the user then open the Report Parameters dialogue box
> >> > > > > in
> >> > > > > report designer and remove any values from the Prompt window.
> >> > > > > This
> >> > > > > will cause the parameters to not display.
> >> > > > >
> >> > > > >

ALL Option

After consulting in MSFT textbooks, I tried adding a UNION to my SELECT
statement for parameters list
Select Distinct Homebase, HomebaseName From dbo.Portal_D_PrvList
UNION Select -1,'All Locations'
It gives me an error message "Error converting NVARCHAR value to datatype
integer" My values in dbo.Portal_D_PrvList tables are nvarchar as they are
text items. Any ideas?
ThanksTry this
Union ALL
Select -1 as Homebase,'All Locations' AS HomebaseName
"Asim" wrote:
> After consulting in MSFT textbooks, I tried adding a UNION to my SELECT
> statement for parameters list
> Select Distinct Homebase, HomebaseName From dbo.Portal_D_PrvList
> UNION Select -1,'All Locations'
> It gives me an error message "Error converting NVARCHAR value to datatype
> integer" My values in dbo.Portal_D_PrvList tables are nvarchar as they are
> text items. Any ideas?
> Thanks
>
>|||Not working!
"johnE" wrote:
> Try this
> Union ALL
> Select -1 as Homebase,'All Locations' AS HomebaseName
> "Asim" wrote:
> > After consulting in MSFT textbooks, I tried adding a UNION to my SELECT
> > statement for parameters list
> > Select Distinct Homebase, HomebaseName From dbo.Portal_D_PrvList
> > UNION Select -1,'All Locations'
> > It gives me an error message "Error converting NVARCHAR value to datatype
> > integer" My values in dbo.Portal_D_PrvList tables are nvarchar as they are
> > text items. Any ideas?
> > Thanks
> >
> >
> >|||You are trying to put an integer (-1) unioned with string. Try this:
Select Distinct Homebase, HomebaseName From dbo.Portal_D_PrvList UNION
Select '-1' as Homebase,'All Locations' as HomebaseName
"Asim" <Asim@.discussions.microsoft.com> wrote in message
news:1B362CCD-3A3A-4E70-A26F-EAC2E8076D1F@.microsoft.com...
> After consulting in MSFT textbooks, I tried adding a UNION to my SELECT
> statement for parameters list
> Select Distinct Homebase, HomebaseName From dbo.Portal_D_PrvList
> UNION Select -1,'All Locations'
> It gives me an error message "Error converting NVARCHAR value to datatype
> integer" My values in dbo.Portal_D_PrvList tables are nvarchar as they are
> text items. Any ideas?
> Thanks
>
>|||Try
union
select convert(varchar, -1) as Homebase
"Asim" <Asim@.discussions.microsoft.com> wrote in message
news:2D8D2E8A-47F8-4866-9547-8B8A0EBA3A09@.microsoft.com...
> Not working!
>
> "johnE" wrote:
>> Try this
>> Union ALL
>> Select -1 as Homebase,'All Locations' AS HomebaseName
>> "Asim" wrote:
>> > After consulting in MSFT textbooks, I tried adding a UNION to my SELECT
>> > statement for parameters list
>> > Select Distinct Homebase, HomebaseName From dbo.Portal_D_PrvList
>> > UNION Select -1,'All Locations'
>> > It gives me an error message "Error converting NVARCHAR value to
>> > datatype
>> > integer" My values in dbo.Portal_D_PrvList tables are nvarchar as they
>> > are
>> > text items. Any ideas?
>> > Thanks
>> >
>> >
>> >