Showing posts with label batch. Show all posts
Showing posts with label batch. Show all posts

Sunday, March 25, 2012

Can I export a report as PDF files within a DOS batch file?

Hi,
Is there any command line tool that helps me to export a report into a PDF
file?
I need to do that within a batch file. I am trying to avoid C# coding to do
that.
Any help would be appreciated,
Maxyes, rs.exe should do what you are trying to accomplish.
--
Shaun Beane, MCT, MCDST, MCDBA
dbageek.blogspot.com
"Maxwell2006" <alanalan@.newsgroup.nospam> wrote in message
news:eU8dFLcXGHA.3724@.TK2MSFTNGP02.phx.gbl...
> Hi,
> Is there any command line tool that helps me to export a report into a PDF
> file?
> I need to do that within a batch file. I am trying to avoid C# coding to
> do that.
> Any help would be appreciated,
> Max
>|||Great! Do you know any link to a sample that shows me how to export and save
the report into a PDF file?
"Shaun Beane" <shaun.beane@.gmail.nojunk.com> wrote in message
news:OhIWIZcXGHA.4148@.TK2MSFTNGP03.phx.gbl...
> yes, rs.exe should do what you are trying to accomplish.
> --
> Shaun Beane, MCT, MCDST, MCDBA
> dbageek.blogspot.com
> "Maxwell2006" <alanalan@.newsgroup.nospam> wrote in message
> news:eU8dFLcXGHA.3724@.TK2MSFTNGP02.phx.gbl...
>> Hi,
>> Is there any command line tool that helps me to export a report into a
>> PDF file?
>> I need to do that within a batch file. I am trying to avoid C# coding to
>> do that.
>> Any help would be appreciated,
>> Max
>>
>|||Hi Maxwell,
You can use the RS.exe Utility to export the report to the PDF file.
RS.exe will read a script file which should be written by VB.NET.
Here is a article posted some sample code, you may try to refer.
http://groups.google.com/group/microsoft.public.sqlserver.reportingsvcs/brow
se_frm/thread/e608c8fecc95d08/8a2dcc6ca82bf3fc?tvc=1&q=RS+utility+export+pdf
&hl=zh-CN#8a2dcc6ca82bf3fc
Hope this will be helpful.
Sincerely,
Wei Lu
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================This posting is provided "AS IS" with no warranties, and confers no rights.

Friday, February 24, 2012

Can Add/update/drop column sql statements in one store procedure?

I have a batch sql statments to add column NewCol into TableA, then update
NewCol at this TableA, then drop column NewCol from TableA. I have no proble
m
to run them as individual sql statment with GO after each statment. But when
I tried to put these sql statements into one store procedure, each time when
compile or run the store procedure, I got error 'Invalid column name'. I
guess column NewCol is not there at beginning. So Can I put Add/update/drop
column in one store procedure?
alter procedure xash
AS
-- other sql regarding to this TableA --
--alter add column--
alter table TableA add NewCol varchar(1) null
-- update new column--
Update TableA
set NewCol= 'Y'
--other operation related this table and new column--
--drop column --
alter table TableA drop COLUMN NewCol
GOYou have to commit the work at each step before the next step can see
it. There is lots of overhead for this.
I have to ask why you are doing this. Instead of having physical
storage hold your computed values, wouldn't it be better to simply have
a VIEW with the computed column in it? Also why do you want to use
VARCHAR(1); think about it.
CREATE VIEW FilteredFoobar (..)
AS
SELECT ..., CASE WHEN <<test here>> THEN 'Y' ELSE 'N' END AS new-col
FROM Foobar, ..
WHERE ..;|||On 13 Apr 2005 16:18:15 -0700, --CELKO-- wrote:

> Also why do you want to use VARCHAR(1); think about it.
You know, it would be nice if SQL implementations could just throw an error
message if you try to create a VARCHAR(1) column. :)

Tuesday, February 14, 2012

Can a DataTable update an SQL Table?

Can you use a DataTable to update an SQL Table and can it be done in a batch UPDATE as opposed to incrementing through every row using a stored procedure similar to UPDATE SQLTable SET Position = @.Position WHERE ID = @.ID?

Yes.. use the dataadapter and dataset

http://www.csharp-station.com/Tutorials/AdoDotNet/Lesson05.aspx

|||

I think I found my misunderstanding with my approach. What I really should be asking is how to I access the Random001 in my DataSet in my Button1_Click event?

public DataTable GetRandLinks()
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionStringA"].ConnectionString);
SqlCommand cmd = new SqlCommand("RandomizerSelect001", con);
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter da = new SqlDataAdapter();
da.SelectCommand = cmd;
DataSet ds = new DataSet();
try
{
da.Fill(ds, "Random001");
return ds.Tables["Random001"];
}
catch
{ throw new ApplicationException("Data error"); }
}
protected void Button1_Click(object sender, EventArgs e)

{

NEED to know how to call the Random001 table so I can make changes in a loop, then write those changes up using da.Update? When I try I keep getting object not found?

}

|||

Wait a bit - I think it finally may be seeing the breaking of dawn - - - -

Friday, February 10, 2012

Calling the same report in a batch (rs2005) from aspx page

Hi,
what would be the best way to call the same report with diffrent
parameters.
right now I am calling the RenderInvoice which is called in a loop
(view code below)
is there a better way to do this, like a batch process?
this works, and it does 50 reports in about one minute, I wonder if I
can make it go faster.
or it's just an issue of computer hardware.
Thanks.
protected Byte[] RenderInvoice(ReportExecutionService rs,string
shipmentId)
{
ParameterValue[] parameters = new ParameterValue[2];
parameters[0] = new ReportExecutionWS.ParameterValue();
parameters[0].Name = "ShipmentId";
parameters[0].Value = shipmentId;
parameters[1] = new ReportExecutionWS.ParameterValue();
parameters[1].Name = "ShowLogo";
parameters[1].Value = "True";
// set report parameters
rs.SetExecutionParameters(parameters, "en-us");
// set rendering info
Byte[] result = null;
String format = "PDF";
String devInfo = "<DeviceInfo><Toolbar>False</Toolbar></
DeviceInfo>";
String extension = "";
String encoding = "";
String mimeType = "";
Warning[] warnings = null;
string[] streamIDs = null;
result = rs.Render(format, devInfo, out extension, out
encoding, out mimeType, out warnings, out streamIDs);
return result;
}You are running the reports one after another. A minute for 50 reports
sounds pretty good to me. RS could do these in parallel but your app would
need to do request the rendering asynchronously. My suggestion is to leave
it alone. I don't think a whole lot of complexity to speed it up more is
worth the effort.
Bruce Loehle-Conger
MVP SQL Server Reporting Services
<rperetz@.gmail.com> wrote in message
news:1182807919.166551.199320@.g4g2000hsf.googlegroups.com...
> Hi,
> what would be the best way to call the same report with diffrent
> parameters.
> right now I am calling the RenderInvoice which is called in a loop
> (view code below)
> is there a better way to do this, like a batch process?
> this works, and it does 50 reports in about one minute, I wonder if I
> can make it go faster.
> or it's just an issue of computer hardware.
> Thanks.
>
> protected Byte[] RenderInvoice(ReportExecutionService rs,string
> shipmentId)
> {
> ParameterValue[] parameters = new ParameterValue[2];
> parameters[0] = new ReportExecutionWS.ParameterValue();
> parameters[0].Name = "ShipmentId";
> parameters[0].Value = shipmentId;
> parameters[1] = new ReportExecutionWS.ParameterValue();
> parameters[1].Name = "ShowLogo";
> parameters[1].Value = "True";
> // set report parameters
> rs.SetExecutionParameters(parameters, "en-us");
> // set rendering info
> Byte[] result = null;
> String format = "PDF";
> String devInfo = "<DeviceInfo><Toolbar>False</Toolbar></
> DeviceInfo>";
> String extension = "";
> String encoding = "";
> String mimeType = "";
> Warning[] warnings = null;
> string[] streamIDs = null;
>
> result = rs.Render(format, devInfo, out extension, out
> encoding, out mimeType, out warnings, out streamIDs);
> return result;
> }
>