Thursday, March 29, 2012
Get all databases in a SQL db
server db ?
TIA,
-FatemaSELECT name FROM master..sysdatabases
Jacco Schalkwijk
SQL Server MVP
"Fatema" <Fatema@.discussions.microsoft.com> wrote in message
news:DEFB1153-6989-4EAB-AFF6-08B58B51806B@.microsoft.com...
> Is it possible to programmatically get a list of all the databases in a
> SQL
> server db ?
> TIA,
> -Fatema|||Thanks for the prompt reply.
I also need answers for the following:
- Is there a way to find out all the instances of the SQL server running ?
- Read the alerts generated by SQL server.
- Read the logs generated by SQL server.
Thanks,
-Fatema
"Jacco Schalkwijk" wrote:
> SELECT name FROM master..sysdatabases
> --
> Jacco Schalkwijk
> SQL Server MVP
>
> "Fatema" <Fatema@.discussions.microsoft.com> wrote in message
> news:DEFB1153-6989-4EAB-AFF6-08B58B51806B@.microsoft.com...
>
>|||Jacco
I can't believe that Jacco has suggested to query a system table :-)
select CATALOG_NAME from INFORMATION_SCHEMA.SCHEMATA
"Jacco Schalkwijk" <jacco.please.reply@.to.newsgroups.mvps.org.invalid> wrote
in message news:u$l6Y7nPFHA.2604@.TK2MSFTNGP10.phx.gbl...
> SELECT name FROM master..sysdatabases
> --
> Jacco Schalkwijk
> SQL Server MVP
>
> "Fatema" <Fatema@.discussions.microsoft.com> wrote in message
> news:DEFB1153-6989-4EAB-AFF6-08B58B51806B@.microsoft.com...
>|||:-)
Jacco Schalkwijk
SQL Server MVP
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:Olf6sSoPFHA.2604@.TK2MSFTNGP10.phx.gbl...
> Jacco
> I can't believe that Jacco has suggested to query a system table :-)
> select CATALOG_NAME from INFORMATION_SCHEMA.SCHEMATA
> "Jacco Schalkwijk" <jacco.please.reply@.to.newsgroups.mvps.org.invalid>
> wrote
> in message news:u$l6Y7nPFHA.2604@.TK2MSFTNGP10.phx.gbl...
>
Friday, March 9, 2012
Generate thousands of SSRS PDFs programmatically with SP or SSIS
of our customers for a billing cycle. There is a table that the report reads
from that gives it all its data necessary for the report (which is a customer
bill) and the table also has a column that has the file name for the PDF for
that particular customers bill for the report. Basically each table row
represents one output report (bill) and each table row has its name nicely
formated for me. Writing the report is not a problem. Figuring out how to
run through thousands of rows generating a PDF for each with the file name
from the table is my challenge.
I would like to create either a SP or a SSIS package (that is scheduled)
that can run a report for each line of data in my table and spit out a PDF
file to a UNC path. It might have to generate thousands of PDFs to a UNC
path that has plenty of space. There will be another SSIS package that
moves the PDFs later to their proper directory.
So, is there someone who has done this before? Any suggestions? Is there a
quick path to doing this, would it take a ton of time? Any tutorials out
there?
Thanks,
Keith
p.s. My preference is to do this in SP's or SSIS and if I need a .NET
language to do that in VB.NET, but I'd rather avoid that if I can.hi,
i had a similar problem and found an easy solution: just create a new
subsciption in reporting services and specify the UNC-output-path and the
column that contains the filename. then schedule the subsciption to run every
night.
"greenmtnsun" wrote:
> I have a report that I'd like to involve in delivering tons of PDFs for each
> of our customers for a billing cycle. There is a table that the report reads
> from that gives it all its data necessary for the report (which is a customer
> bill) and the table also has a column that has the file name for the PDF for
> that particular customers bill for the report. Basically each table row
> represents one output report (bill) and each table row has its name nicely
> formated for me. Writing the report is not a problem. Figuring out how to
> run through thousands of rows generating a PDF for each with the file name
> from the table is my challenge.
> I would like to create either a SP or a SSIS package (that is scheduled)
> that can run a report for each line of data in my table and spit out a PDF
> file to a UNC path. It might have to generate thousands of PDFs to a UNC
> path that has plenty of space. There will be another SSIS package that
> moves the PDFs later to their proper directory.
> So, is there someone who has done this before? Any suggestions? Is there a
> quick path to doing this, would it take a ton of time? Any tutorials out
> there?
> Thanks,
> Keith
> p.s. My preference is to do this in SP's or SSIS and if I need a .NET
> language to do that in VB.NET, but I'd rather avoid that if I can.|||I don't think I understand how your suggestion could work.
I see nothing on the subscription that allows me to specify a column in a
table that assigns a file name. Perhaps there is a way to use an expression
but I don't know about it.
More importantly I also see nothing that allows me to tell this subscription
that it needs to create one PDF per customer. There is no looping mechanism.
Were you suggesting I create a schedule for EVERY customer? If so, I can't
do that.
Did I miss something?
Keith
"csc67" wrote:
> hi,
> i had a similar problem and found an easy solution: just create a new
> subsciption in reporting services and specify the UNC-output-path and the
> column that contains the filename. then schedule the subsciption to run every
> night.
> "greenmtnsun" wrote:
> > I have a report that I'd like to involve in delivering tons of PDFs for each
> > of our customers for a billing cycle. There is a table that the report reads
> > from that gives it all its data necessary for the report (which is a customer
> > bill) and the table also has a column that has the file name for the PDF for
> > that particular customers bill for the report. Basically each table row
> > represents one output report (bill) and each table row has its name nicely
> > formated for me. Writing the report is not a problem. Figuring out how to
> > run through thousands of rows generating a PDF for each with the file name
> > from the table is my challenge.
> >
> > I would like to create either a SP or a SSIS package (that is scheduled)
> > that can run a report for each line of data in my table and spit out a PDF
> > file to a UNC path. It might have to generate thousands of PDFs to a UNC
> > path that has plenty of space. There will be another SSIS package that
> > moves the PDFs later to their proper directory.
> >
> > So, is there someone who has done this before? Any suggestions? Is there a
> > quick path to doing this, would it take a ton of time? Any tutorials out
> > there?
> >
> > Thanks,
> > Keith
> >
> > p.s. My preference is to do this in SP's or SSIS and if I need a .NET
> > language to do that in VB.NET, but I'd rather avoid that if I can.|||Hi Keith,
sorry for being a little bit short on details but memory fades in time...
What you need to do is to define a datadriven subsciption. this doesn´t work
with windows-authentication in your reports connection-string. instead store
a user and password on report server (report properties, data source).
In step 1 of the datadriven subsription you define that the reports are to
be stored in the filesystem. in step 2 leave a connection string. here you
can store windows-credentials for a (super-) user. step 3 is were you then
define a sql query witch returns (at least) the filename plus
report-parameters. More possible fields to generated here and use in step 4
are: the UNC-path or the renderformat (a different for each customer for
example). the user and password provided on this page are for writing files
into the filesystem.
in step 5 you can then match report-parameters with your query from step 3
and finally define a schedule.
have fun!
"greenmtnsun" wrote:
> I don't think I understand how your suggestion could work.
> I see nothing on the subscription that allows me to specify a column in a
> table that assigns a file name. Perhaps there is a way to use an expression
> but I don't know about it.
> More importantly I also see nothing that allows me to tell this subscription
> that it needs to create one PDF per customer. There is no looping mechanism.
> Were you suggesting I create a schedule for EVERY customer? If so, I can't
> do that.
> Did I miss something?
> Keith
> "csc67" wrote:
> > hi,
> >
> > i had a similar problem and found an easy solution: just create a new
> > subsciption in reporting services and specify the UNC-output-path and the
> > column that contains the filename. then schedule the subsciption to run every
> > night.
> >
> > "greenmtnsun" wrote:
> >
> > > I have a report that I'd like to involve in delivering tons of PDFs for each
> > > of our customers for a billing cycle. There is a table that the report reads
> > > from that gives it all its data necessary for the report (which is a customer
> > > bill) and the table also has a column that has the file name for the PDF for
> > > that particular customers bill for the report. Basically each table row
> > > represents one output report (bill) and each table row has its name nicely
> > > formated for me. Writing the report is not a problem. Figuring out how to
> > > run through thousands of rows generating a PDF for each with the file name
> > > from the table is my challenge.
> > >
> > > I would like to create either a SP or a SSIS package (that is scheduled)
> > > that can run a report for each line of data in my table and spit out a PDF
> > > file to a UNC path. It might have to generate thousands of PDFs to a UNC
> > > path that has plenty of space. There will be another SSIS package that
> > > moves the PDFs later to their proper directory.
> > >
> > > So, is there someone who has done this before? Any suggestions? Is there a
> > > quick path to doing this, would it take a ton of time? Any tutorials out
> > > there?
> > >
> > > Thanks,
> > > Keith
> > >
> > > p.s. My preference is to do this in SP's or SSIS and if I need a .NET
> > > language to do that in VB.NET, but I'd rather avoid that if I can.
Generate thousands of SSRS PDFs programmatically with SP or SSIS
I would like to create either a SP or a SSIS package (that is scheduled) that can run a report for each line of data in my table and spit out a PDF file to a UNC path. It might have to generate thousands of PDFs to a UNC path that has plenty of space. There will be another SSIS package that moves the PDFs later to their proper directory.
So, is there someone who has done this before? Any suggestions? Is there a quick path to doing this, would it take a ton of time? Any tutorials out there?
Thanks,
Keith
p.s. My preference is to do this in SP's or SSIS and if I need a .NET language to do that in VB.NET, but I'd rather avoid that if I can.
Yes, I am actually doing something similar in SSIS with reports.
I'm not generating thousands of them, but I am calling into RS and saving out a PDF file at the end of a process, from withinthe SSIS package. Earlier in the package there is some loop processing where I'm building and saving multiple files to disk, that part isn't a problem for you I'm sure. It was hard for me, but I'm not really very knowledgeable about SSIS <g>. You sound like you like it!
I use package variables to hold the various things I need from RS, and another variable for the output dir... which I use if the derived output file name doesn't come complete with a full path.
NB: I'm using URL Access, because I see absolutely no advantage to using SOAP for this. IOW, I just used a straight script (not ActiveX Script) task, not a Web Service task. Your mileage may vary.
The actual VB.NET code I use in the script task is a variant of what I posted in this thread. http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1718577&SiteID=1 -- you'll even see the Dts variables referenced there <s>.
The only real "gotcha" I've found with this approach in SSIS (the URL Access part I mean) is building up the request URL properly with parameters, without having an ampersand mistakenly encoded or something from having been stored in the package variable. It's handleable and I'm not sure you even indicated that you need to worry about this. I think you'll see that hack in the code snippet in the thread referenced above.
So... Which part is really bothering you? The scaleability aspect, or ensuring rights to the output path, passing the credentials to the reporting server, or what? If it's the credentials I'm not really expert with that either but the same techniques are going to work as you would use *outside* of SSIS, in any VB.NET app that calls out to RS.
>L<
|||If you are using SSRS Enterprise, you should look into using "Data Driven Subscriptions". It sounds like that is exactly what you need. Creating an SSIS package to do what you're talking about would probably be overkill since the feature is out of the box with SSRS.Here's a link to get you started:
http://technet.microsoft.com/en-us/library/ms159150.aspx
|||
I'm not sure it's overkill. I guess it depends on what you're comfortable with and where you want to do the work.
* -- the OP is already using a separate package to move the files after creation. This argues for a combined process, to make sure that things happen in the right sequence.
* -- the OP is concerned about scaleability (I have asked him/her for details, and it may be justified or not; we can't say). IAC the point is that moving the behavior out of RS may be legitimate as a way of moving some of the activity to a different box.
It's definitely do-able either way ...
>L<
Generate thousands of SSRS PDFs programmatically with SP or SSIS
I would like to create either a SP or a SSIS package (that is scheduled) that can run a report for each line of data in my table and spit out a PDF file to a UNC path. It might have to generate thousands of PDFs to a UNC path that has plenty of space. There will be another SSIS package that moves the PDFs later to their proper directory.
So, is there someone who has done this before? Any suggestions? Is there a quick path to doing this, would it take a ton of time? Any tutorials out there?
Thanks,
Keith
p.s. My preference is to do this in SP's or SSIS and if I need a .NET language to do that in VB.NET, but I'd rather avoid that if I can.
Yes, I am actually doing something similar in SSIS with reports.
I'm not generating thousands of them, but I am calling into RS and saving out a PDF file at the end of a process, from withinthe SSIS package. Earlier in the package there is some loop processing where I'm building and saving multiple files to disk, that part isn't a problem for you I'm sure. It was hard for me, but I'm not really very knowledgeable about SSIS <g>. You sound like you like it!
I use package variables to hold the various things I need from RS, and another variable for the output dir... which I use if the derived output file name doesn't come complete with a full path.
NB: I'm using URL Access, because I see absolutely no advantage to using SOAP for this. IOW, I just used a straight script (not ActiveX Script) task, not a Web Service task. Your mileage may vary.
The actual VB.NET code I use in the script task is a variant of what I posted in this thread. http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1718577&SiteID=1 -- you'll even see the Dts variables referenced there <s>.
The only real "gotcha" I've found with this approach in SSIS (the URL Access part I mean) is building up the request URL properly with parameters, without having an ampersand mistakenly encoded or something from having been stored in the package variable. It's handleable and I'm not sure you even indicated that you need to worry about this. I think you'll see that hack in the code snippet in the thread referenced above.
So... Which part is really bothering you? The scaleability aspect, or ensuring rights to the output path, passing the credentials to the reporting server, or what? If it's the credentials I'm not really expert with that either but the same techniques are going to work as you would use *outside* of SSIS, in any VB.NET app that calls out to RS.
>L<
|||If you are using SSRS Enterprise, you should look into using "Data Driven Subscriptions". It sounds like that is exactly what you need. Creating an SSIS package to do what you're talking about would probably be overkill since the feature is out of the box with SSRS.Here's a link to get you started:
http://technet.microsoft.com/en-us/library/ms159150.aspx
|||
I'm not sure it's overkill. I guess it depends on what you're comfortable with and where you want to do the work.
* -- the OP is already using a separate package to move the files after creation. This argues for a combined process, to make sure that things happen in the right sequence.
* -- the OP is concerned about scaleability (I have asked him/her for details, and it may be justified or not; we can't say). IAC the point is that moving the behavior out of RS may be legitimate as a way of moving some of the activity to a different box.
It's definitely do-able either way ...
>L<
Sunday, February 26, 2012
Generate Report Model from Cube with perspectives
1. Is there a way to generate SMDL programmatically from a cube besides using the RS Webservice API?
2. Is there a way to programmatically modify the SMDL once it has been created without doing crazy xml manipulation?
3. How can I create a Report Model from a cube with multiple perspectives? I want the model to only contain one perspective of the cube.
First, there's a real lack of responses on this forum....but hopefully this will help someone else that ran into these issues.
1. It's better to modify the SMDL that's generated from the API then to try and create it from scratch
2. The only way is with xml manipulation but it's actually not that bad. The schema is pretty simple. It just looks bloated at first with lots of repeating elements.
3. When the SMDL is generated, each perspective in the cube becomes a perspective in the report model. Then you can trim down the perspectives you don't want by removing the corresponding element from the SMDL and saving it back to reporting services.
Other things I notice is that once you modify the SMDL, you can't regenerate it using the Regenerate API call. Instead, you have to delete it and recreate it again. Also, once you recreate a model, you have to link up all the reports that were previously associated with it. I have no idea why RS removes the datasource from reports when the model is deleted. It's probably better to just leave it and if the datasource isn't there, then throw an error.
|||Other things I notice is that once you modify the SMDL, you can't regenerate it using the Regenerate API call. Instead, you have to delete it and recreate it again. Also, once you recreate a model, you have to link up all the reports that were previously associated with it. I have no idea why RS removes the datasource from reports when the model is deleted. It's probably better to just leave it and if the datasource isn't there, then throw an error.
Actually, you will want to use the SetModelDefinition API instead of Renenerate. Items in the Report Server database are linked by GUID, not name. Just because it has the same name, we don't assume that it is the same item.
|||I do use SetModelDefinition API to modify the SMDL. But after a cube has been processed and the structure changed, I will need to regenerate the model base on the new cube. If I do that, all my reports break because the datasource reference is no longer valid even though the model has been recreated. This makes sense in the situations where the report may contain references to dimensions/measures no longer in the datasource. However, in my case, dimensions/measures are often added to the cube and not removed. I just think it's better to leave the datasource and have the report fail if dimensions/measures are missing instead of ALWAYS failing with an invalid datasource.Sunday, February 19, 2012
Generate a report, export to PDF
a report, export this report to PDF, and pop up adobe acrobat reader in a web
browser in one click while naming the PDF file exactly as I like, including
its path. I currently do this easily with Crystal Reports in one click, but
I need to see if its feasible in RS.
In crystal I use an ASP.net page that does all of this for me. I declare the
report, get the parameters, fill them, set up the username/password for the
database, set a name for the file, and set the export options, and then
generate the report.
If I could get some direction as to how to do some of this stuff, it would
be great =) We are thinking that while its not pretty we are going to use the
URL method if possible to do this stuff, because we already have a custom web
app in place, and no need for a shell etc. We just need a web page that can
do this for us upon hitting submit.
Again, any direction you can offer would be great
TIAHi Pinolian:
From ASP.NET you code access the report server with URL access and the
WebClient or WebRequest classes. Once you have the file pulled down to
the ASP.NET application you could stream the file to the client by
setting the content disposition header and using Response.BinaryWrite.
Some sample code would look like this:
byte[] response;
string url = "http://s/reportserver?Report&rs:Format=PDF";
using(WebClient webClient = new WebClient())
{
webClient.Credentials = CredentialCache.DefaultCredentials;
response = webClient.DownloadData(url);
}
Response.ContentType="application/pdf";
Response.AddHeader(
"content-disposition",
"attachment; filename=MyPDF.PDF"
);
Response.BinaryWrite(response);
--
Scott
http://www.OdeToCode.com/blogs/scott/
On Tue, 19 Oct 2004 13:59:01 -0700, "Pinolian"
<Pinolian@.discussions.microsoft.com> wrote:
> I want to programmatically pass in some parameters, generate
>a report, export this report to PDF, and pop up adobe acrobat reader in a web
>browser in one click while naming the PDF file exactly as I like, including
>its path. I currently do this easily with Crystal Reports in one click, but
>I need to see if its feasible in RS.
>In crystal I use an ASP.net page that does all of this for me. I declare the
>report, get the parameters, fill them, set up the username/password for the
>database, set a name for the file, and set the export options, and then
>generate the report.
>If I could get some direction as to how to do some of this stuff, it would
>be great =) We are thinking that while its not pretty we are going to use the
>URL method if possible to do this stuff, because we already have a custom web
>app in place, and no need for a shell etc. We just need a web page that can
>do this for us upon hitting submit.
>Again, any direction you can offer would be great
>TIA