Showing posts with label generated. Show all posts
Showing posts with label generated. Show all posts

Saturday, February 25, 2012

Capturing Report Parameters

I am trying to capture the selected report parameters for a generated
report prior to it being sent to the server. The intent is to use
these values to set as defaults for the saved linked report. I have
no problem retrieving the list of valid values but don't know if the
values selected in the ReportView can be captured. Any Ideas?
PaulOn Dec 18, 3:04 pm, Paul <blackwell_p...@.hotmail.com> wrote:
> I am trying to capture the selected report parameters for a generated
> report prior to it being sent to the server. The intent is to use
> these values to set as defaults for the saved linked report. I have
> no problem retrieving the list of valid values but don't know if the
> values selected in the ReportView can be captured. Any Ideas?
> Paul
It's not very likely that this is possible (in terms of capturing the
report parameter on the client-side). You could try using Javascript;
but, this is a long shot. If you are just trying to pass the parameter
value selected to another report (via Jump to Report, Jump to URL,
etc) You can just set the report to jump to (or the URL of the report)
and then select the parameter to pass to it (or in the case of using a
URL, append the Parameter's value). To access the parameter's value
you would set the Parameter to an expression similar to:
=Parameters!Param1Name.Value
If using a URL, a similar expression to this should work.
="http://ServerX/reportserver?/SomeReportsDirectory/
ReportName&rs:Command=Render&Param1=" + Parameters!Param1.Value
Hope this helps.
Regards,
Enrique Martinez
Sr. Software Consultant

Capturing exec or sp_executesql result

Hi.. perhaps it's stupid, but i am really a newbie..
How can i capture the result generated from exec('select ... ') or sp_executesql? such as

sp_executesql 'SELECT max(ID) FROM Yr' + year(getdate) + '.dbo.Sales' + month(getdate)

How can i get the 'max(ID)' data? I must get the data from sp_executesql or execute form.as far as I know the only way to capture the results from EXECUTE is to insert it into a temp table and then select out what you are looking for.|||You can set a variable from sp_executesql

declare @.id int, @.sql nvarchar(1000)
select @.sql = 'SELECT max(ID) FROM Yr' + year(getdate) + '.dbo.Sales' + month(getdate)

exec sp_executesql @.sql, N'@.id int output', @.id output|||oops

declare @.id int, @.sql nvarchar(1000)
select @.sql = 'SELECT @.id = max(ID) FROM Yr' + year(getdate) + '.dbo.Sales' + month(getdate)

exec sp_executesql @.sql, N'@.id int output', @.id output

see
www.nigelrivett.com
sp_executesql

Sunday, February 19, 2012

Capture errors from "isql"

Hi,

Just wanted to know if there is anyway I can capture errors generated in the SQL batch passed into isql with the "-i" option.

ie

If there is an sql batch store in file say test.sql and I pass it as input to isql as

isql -Uxxxx -itest.sql -Pyyyy

is there anyway I can figure out (outside the isql using error valriables like $status in UNIX C-shell or ERRORLEVEL in DOS) if all the SQLs in that script file (test.sql) has executed successfully or notRE:
Hi, Just wanted to know if there is anyway I can capture errors generated in the SQL batch passed into isql with the "-i" option. ie If there is an sql batch store in file say test.sql and I pass it as input to isql as isql -Uxxxx -itest.sql -Pyyyy

Q1 Is there ANY way I can figure out (outside the isql using error valriables like $status in UNIX C-shell or ERRORLEVEL in DOS) if all the SQL in that script file (test.sql) has executed successfully or not?

This may not be the desired answer, however the question asked about (ANY) way.

A1 Yes.

One approach would require some development; assuming each stored procedure or a batch is designed to return meaningful "result codes"; one could programatically parse the resulting output file to examine each "result code" in the output file e.g.(osql -Uxxxx -itest.sql -Pyyyy -oOutPutFile.out).|||I tried the "-b" option and that worked too. The %ERRORLEVEL% was able to have a non-0 value in case of errors.