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 19, 2012
generate a xml file from sql server 2000?
hi there.
i'm using asp.net 2 page i'm accessing a table consists of 100 thousands rows and its slow and i'm wondering instead of accessing directly to the table how about if i access via xml ?
generate xml and cache it and use the xml file rather going to sql server database?
has anybody have any help on this?
the steps invloved:
1) first generate a xml file from table something like this:
select * from dbo.LOOK_UP FOR XML AUTO, XMLDATA ?
SELECT * FROM dbo.LOOK_UP FOR XML RAW, ELEMENTS ?
SELECT * FROM dbo.LOOK_UP FOR XML AUTO ?
which one should i use and how do i access after i gnerate a xml file
thanks.
Do you have a PrimaryKey (or clustered index) on that table? Yes, access such a large table in SQL2000 database would be slow, but you can speed up query by using clustered index seek, which I believe should be much quicker than accessing XML file. You can take a look at this link to learn more about clustered index:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/createdb/cm_8_des_05_5h6b.asp
|||i do have primary keys and culstered index
but is that true that, if i access xml file it will boost my access speed?
i can cache my xml file and use from cache?
|||My recomendation is run some test and look for these two System stored procs in the Master database sp_xml_preparedocument and sp_xml_removedocument because you can use them to do a lot of things with XML in SQL Server 2000. The links below show you several options including the Dataset.ReadXml method. Hope this helps.
http://msdn.microsoft.com/msdnmag/issues/05/06/DataPoints/default.aspx
http://forums.asp.net/thread/1024186.aspx
|||
after i run the below code:
DECLARE @.hdoc int
DECLARE @.doc varchar(2000)
SET @.doc = '
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE root
[<!ELEMENT root (Customers)*>
<!ELEMENT Customers EMPTY>
<!ATTLIST Customers CustomerID CDATA #IMPLIED ContactName CDATA #IMPLIED>]>
<root>
<Customers CustomerID="ALFKI" ContactName="Maria Anders"/>
</root>'
EXEC sp_xml_preparedocument @.hdoc OUTPUT, @.doc
what do i do after that?
|||The second page of the thread I gave include a sample using repeater and the ReadXml method of the dataset. Hope this helps.