Monday, February 13, 2012
[?] User's global variables
Is it possible to define a global variable within a report? It has to be
populated in one DataSet and accessed from other DataSets.
Thanks,
Lucy.Related previous post:
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=d0f4d02b-b032-47e8-8318-169052421237.
--
Ravi Mumulla (Microsoft)
SQL Server Reporting Services
This posting is provided "AS IS" with no warranties, and confers no rights.
"Lusy Crown" <evesq@.uk2.net> wrote in message
news:uad4evlaEHA.716@.TK2MSFTNGP11.phx.gbl...
> Hello,
> Is it possible to define a global variable within a report? It has to be
> populated in one DataSet and accessed from other DataSets.
> Thanks,
> Lucy.
>|||Probably not ;-(
How can I populate such variable (declared in custom code) in a DataSet?
Thanks,
Lucy.
"Ravi Mumulla (Microsoft)" <ravimu@.online.microsoft.com> wrote in message
news:%23gh%23zcnaEHA.2056@.TK2MSFTNGP12.phx.gbl...
> Related previous post:
>
http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.reportingsvcs&mid=d0f4d02b-b032-47e8-8318-169052421237.
> --
> Ravi Mumulla (Microsoft)
> SQL Server Reporting Services
> This posting is provided "AS IS" with no warranties, and confers no
rights.
> "Lusy Crown" <evesq@.uk2.net> wrote in message
> news:uad4evlaEHA.716@.TK2MSFTNGP11.phx.gbl...
> > Hello,
> >
> > Is it possible to define a global variable within a report? It has to be
> > populated in one DataSet and accessed from other DataSets.
> >
> > Thanks,
> > Lucy.
> >
> >
>
Saturday, February 11, 2012
@@sqlstatus error
Is @.@.sqlstatus not a global variable. Why am I getting this error.
Code Snippet
declare @.obj_type varchar(50);
declare @.obj_name varchar(50);
declare @.schema varchar(100);
select @.schema = 'new';
declare schema_object cursor for
select obj.type, obj.name
from sys.objects obj join sys.schemas s on (s.schema_id = obj.schema_id)
where s.name = @.schema
open schema_object
fetch schema_object into @.obj_type, @.obj_name;
while (@.@.sqlstatus = 0)
begin
fetch schema_object into @.obj_type, @.obj_name;
end
close schema_object
Msg 137, Level 15, State 2, Line 14
Must declare the scalar variable "@.@.sqlstatus".
I think u must use @.@.Fetch_Status instead of @.@.sqlstatus but I'm not sure about that
just give a try
Thursday, February 9, 2012
@@RowCount output param
The following stored procedure sets a value for the @.@.RowCount global variable.
How do I make use of it in the Data Access Layer?
When I set the SPROC as the source for the object, the value numberRows does not appear to be an option. In the end I just want to set the value of @.@.RowCount to a Label.Text
What should I do?
ALTER PROCEDURE dbo.ap_Select_ModelRequests_RequestDateTime@.selectDatedatetime ,@.selectCountryInt ASSELECT DISTINCT confignameFROM ModelRequestsJOIN CC_host.dbo.usr_cmcAs t2ON t2.user_id = ModelRequests.usernameJOIN CountriesONCountries.Country_Short = t2.countryWHERE RequestDateTime >= @.selectDateand RequestDateTime <dateadd(dd,1, @.selectDate)AND configname <>''AND interfacenameLIKE'%DOWNLOAD%'AND result = 0AND Country_ID = @.selectCountryORDER BY confignameSELECT@.@.RowCountAs numberRowsGO
try this:
declare @.MyRowCounter int
select @.MyRowCounter = @.@.RowCount as numberRows
This will work as written, but what you get back is an answer set with 1 row and 1 column, you would use a datareader to read it.
A perhaps better -- or at least clearer -- way is to store the number in an output variable. Then, when you set up the call to execute the proc you declare the parameter direction as OUTPUT (this link has an example --http://www.msdner.com/forum/thread445973.html)
ALTER PROCEDURE dbo.ap_Select_ModelRequests_RequestDateTime
@.selectDatedatetime
,@.selectCountryInt
,@.numberRows int OUTPUT
AS
SELECT DISTINCT confignameFROM ModelRequestsJOIN
CC_host.dbo.usr_cmcAs t2ON
t2.user_id = ModelRequests.usernameJOIN
CountriesON
Countries.Country_Short = t2.country
WHERE RequestDateTime >= @.selectDateand RequestDateTime <dateadd(dd,1, @.selectDate)
AND configname <>''AND interfacenameLIKE'%DOWNLOAD%'AND result = 0AND Country_ID = @.selectCountry
ORDER BY configname
SELECT @.numberRows=@.@.rowcount