Showing posts with label method. Show all posts
Showing posts with label method. Show all posts

Wednesday, March 28, 2012

Proportional fill

All,

SQL Server uses a proportional fill method to add data to file groups where
a file group has multiple files. In general this is a good thing.
Unfortunately, the method appears to get switched off when new file(s) is
added. Other than exporting the data out of the filegroup, recreating the
filegroup and putting the data back in, is there a way to respread the
existing data back out and switching the proportional fill method back on?

Thanks,
DannyAs far as I know, there's no way to influence where MSSQL places data
within a filegroup. I'm not sure what you mean by "switched off" - if
you can give more details of what you're seeing, and what problem it
causes, then someone may have a suggestion.

Simon|||You can not turn this behavior off. I think what you mean is that when you
add a file to the filegroup the data is not re-balanced to evenly distribute
the data across all files including the new one. This is the way the system
is designed. You would have to force it by rebuilding indexes, but this
introduces a space requirement and a period in which the table is offline
during the rebuild.

GertD@.SQLDev.Net

Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright SQLDev.Net 1991-2005 All rights reserved.

"Danny" <someone@.nowhere.com> wrote in message
news:9dRke.1781$5T2.877@.trnddc01...
> All,
> SQL Server uses a proportional fill method to add data to file groups
> where a file group has multiple files. In general this is a good thing.
> Unfortunately, the method appears to get switched off when new file(s) is
> added. Other than exporting the data out of the filegroup, recreating the
> filegroup and putting the data back in, is there a way to respread the
> existing data back out and switching the proportional fill method back on?
> Thanks,
> Danny

Friday, March 9, 2012

Programmatically how to verify() report settings

Hello Guys,

I would like to verify report in runtime programmtically. THe problem I am facing is if I call Verify() method it populates a message box with "THe database is uptodate" which I would like to suppress somehow.

I would like to know what is the correct method to verify() report's settings at runtime. Euiqvalent of verify() function.

Thanks
Dilemmaif u got answer plz tell me?
I have same problem.

bhvrsingh@.yahoo.com

Programmatically doing new role assignments

Hello everyone -
A friend of mine is having some trouble using the browser based method
of assigning roles and I suggested that we do it programmatically just
in case errors were being suppressed by IE. So far I've seen a lot of
code that creates roles but none that assigns the role to a Windows
group. So for example, I've seen code that can build a role called FOO
with tasks A,B,C associated but how can I assign WINDOMAIN\Users to
that role?
Thanks much,
David SeruyangeJust in case anyone else runs into this, it is done with a policy
object - a short snippet of code like this will do the trick:
MyRS.ReportingService tmp = new MyRS.ReportingService();
// below the NetworkCredential class accepts 3 arguments:
// USERNAME, PASSWORD, DOMAIN
// this is to connect to ReportServer so use an admin account
tmp.Credentials = new NetworkCredential("myusername", "mypassword",
"MYDOMAIN");
try{
Role[] roles = tmp.ListRoles();
foreach(Role r in roles){
if(r.Name == "Browser"){
// modify 'r'
bool bInherit;
Policy[] polis = tmp.GetPolicies("/", out bInherit);
Policy[] pcopy = new Policy[polis.Length + 1];
Array.Copy(polis, pcopy, polis.Length);
Policy np = new Policy();
// MAKE THIS USERNAME CORRESPOND WITH A
// DOMAIN ACCOUNT
np.GroupUserName = @."DOMAIN\User";
np.Roles = new Role[]{r};
pcopy[pcopy.Length -1] = np;
// ASSIGN THIS to the FOLDER that contains
// your report off the ROOT "/"
tmp.SetPolicies("/REPORTFOLDER",pcopy);
Console.Write("Policy assignment has been made.");
}
}
}
catch(Exception ex){
Console.WriteLine(ex.ToString());
}|||david.seruyange@.gmail.com wrote:
> group. So for example, I've seen code that can build a role called
> FOO with tasks A,B,C associated but how can I assign WINDOMAIN\Users
> to that role?
David,
look at bryan's blog under http://blogs.msdn.com/bryanke/articles/91726.aspx
You will find a really good example-script
regards
Frank

Wednesday, March 7, 2012

Programmatically aborting a package

Can a package executed from code be aborted in code? The Package class has an Execute() method but no Abort() method. Clearly the debugger can stop a package at any point, so it must be possible somehow.

Are you trying to capture an error and then halt? If so, there's always the FireError event that can be thrown.|||

JeffJohnsonMVPVB wrote:

Can a package executed from code be aborted in code? The Package class has an Execute() method but no Abort() method. Clearly the debugger can stop a package at any point, so it must be possible somehow.

You're right, the debugger can do that but it might be a misnomer to think that that is the same as aborting from within thw package.

I presume that your abort code would be conditional so I would suggest that the best way to achieve what you want is to use conditional precedence constraints. If you need any help with those, feel free to reply.

-Jamie

|||

Okay, I need to expound. I have created a Windows service that executes SSIS packages. Many of these are long-running, perhaps for hours. If an operator realizes that something is wrong after submitting a package, I'd like to allow him to send a cancel request to the service and then have the service stop the package. What I do NOT want to do is code every single precedence constraint to check for an "abort" flag (and I'm not sure I'd even know how to set such a flag once the package has started without putting an MSMQ task or the like between each executable--yuck!). Could I simply kill the thread that is executing the package? That seems "dirty," and I was hoping for a cleaner method.

|||

I've taken a look at the application class (http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.application_members.aspx) and the package class (http://msdn2.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.package_members.aspx) and I don't see anything in there that would help.

I can understand why. An executing SSIS package is meant to be a batch/unattended process - once its running you just leave it to get on with it. I fear killing the process might be the way to go.

If you didn't want to put a conditional precedence constraint onto every executable then another option might be to put the executable that conditionally "kills" the package into the package container's OnPostExecute eventhandler. This *could* potentially be a little bit more "graceful" about it than just killing the process. Might be worth a try.

-Jamie

|||

There is a cleaner method. Call RunningPackage.Stop().|||

If your service is starting processes asynchronously your best bet is track the process id. The service could check periodically if the process had ended and "forget" the process if it had. That would give you a way to track what was currently running as well as select a process to kill.. If you want something intelligent in your logging, just have the service write to whatever you use for logging once the process has gone away. Maybe something like *** Operator Canceled ***|||

jaegd wrote:

There is a cleaner method. Call RunningPackage.Stop().

Does this work for file system based packages executed from command line dtexec or otherwise?|||

That looks perfect. I should've scanned the class library reference more thoroughly. I'll try to remember to let everyone know how it works.

(Clearly I don't know how to use the quoting feature, sorry.)

|||

Follow-up question: does anyone know if SSIS raises any particular events when RunningPackage.Stop is called? I could trap these events in my custom tasks and fail them cleanly if so.

|||

Yes the SSIS runtime does signal an event when RunningPackage.Stop() is called. You can get at that event by polling periodically -- call to FireQueryCancel() in a custom task, let's say, at strategic points.

If you don't want to poll, you could wrap the the system variable System::CancelEvent in a SafeHandle and wait for the event to be signalled. That also works.

SSIS stock tasks vary at the frequency which they check if the package's Cancel event has been signalled, but they do check it periodically (no, its not documented the frequency at which the runtime check's the cancel event's state).

|||

RunningPackage.Stop() works on package invoked by any "mechanism", since its the same runtime. That includes command line, BIDS, custom invocation util (whatever you can dream up, e.g. web service, windows service), not to mention in-process or out-of-process package executions via Execute Package tasks.

Saturday, February 25, 2012

Programing: RENDER METHOD and PAGE COUNTS for HTML Rendering

We understand how to use the Render method of the RS web service. And can
successfully render reports in image and PDF formats. I am having a problem
with HTML rendering. we understand how to (and are able to) render HTML
reports as a single "section" (i.e. page) or to generate all sections in a
single call. I am not sure how to ask the RS web service to tell me the
total number of "sections" (pages) in an HTML rendered report. Can anyone
help with this? we know it must be straight forward but have not found how.
thanks.
dlrThere is no direct way of determining number of pages
returned by the render method.
But when you call the render method you can see that the
method returns streamIds.
Your first page comes as as the byte array and the
remaining pages have streamIds associated.
So the number of pages is basically : StreamIds.Length+1
>--Original Message--
>We understand how to use the Render method of the RS web
service. And can
>successfully render reports in image and PDF formats. I
am having a problem
>with HTML rendering. we understand how to (and are able
to) render HTML
>reports as a single "section" (i.e. page) or to generate
all sections in a
>single call. I am not sure how to ask the RS web service
to tell me the
>total number of "sections" (pages) in an HTML rendered
report. Can anyone
>help with this? we know it must be straight forward but
have not found how.
>thanks.
>dlr
>
>.
>|||beg to differ. When I render using and IMAGE format I get StreamIDs (and
thus a page count as StreamIDs + 1) but when I render using an HTML format
StreamIDs are always null!
(I have no image links in the report).
what saz's you now?
thanks.
dlr
"Ravi" <ravikantkv@.rediffmail.com> wrote in message
news:84c401c495d0$4572bca0$a301280a@.phx.gbl...
> There is no direct way of determining number of pages
> returned by the render method.
> But when you call the render method you can see that the
> method returns streamIds.
> Your first page comes as as the byte array and the
> remaining pages have streamIds associated.
> So the number of pages is basically : StreamIds.Length+1
> >--Original Message--
> >We understand how to use the Render method of the RS web
> service. And can
> >successfully render reports in image and PDF formats. I
> am having a problem
> >with HTML rendering. we understand how to (and are able
> to) render HTML
> >reports as a single "section" (i.e. page) or to generate
> all sections in a
> >single call. I am not sure how to ask the RS web service
> to tell me the
> >total number of "sections" (pages) in an HTML rendered
> report. Can anyone
> >help with this? we know it must be straight forward but
> have not found how.
> >
> >thanks.
> >
> >dlr
> >
> >
> >.
> >

Programatticaly setting up history snapshot schedule

I am trying to do this with a web service but cant seem to figure out how,
as there is no direct method or function for it, it seems. But I have a
report I created programatically through the web services. Now I want to set
up a history snapshot schedule for it, I already have schedules set up on
the server as shared schedules, but now I need to tie them to the report to
have them execute according to the schedule. Any ideas on how to do this?
Google wasnt much help to me in finding info. thanks!Is this particular report is going to be fixed for running from a snapshot ?
In that case go to Report manager and select that particular
report->Properties ->execution and select "Render this report from a report
execution snapshot"
Amarnath, MCTS
"Smokey Grindel" wrote:
> I am trying to do this with a web service but cant seem to figure out how,
> as there is no direct method or function for it, it seems. But I have a
> report I created programatically through the web services. Now I want to set
> up a history snapshot schedule for it, I already have schedules set up on
> the server as shared schedules, but now I need to tie them to the report to
> have them execute according to the schedule. Any ideas on how to do this?
> Google wasnt much help to me in finding info. thanks!
>
>|||Unfortinuatly that doesnt solve my problem of how to do it programatically,
which is what I was trying to find out, but I eventually found the web
service method SetReportHistoryOptions
"Amarnath" <Amarnath@.discussions.microsoft.com> wrote in message
news:87D6EAAC-C394-4A82-9140-F3FE9B30F8F3@.microsoft.com...
> Is this particular report is going to be fixed for running from a snapshot
> ?
> In that case go to Report manager and select that particular
> report->Properties ->execution and select "Render this report from a
> report
> execution snapshot"
> Amarnath, MCTS
> "Smokey Grindel" wrote:
>> I am trying to do this with a web service but cant seem to figure out
>> how,
>> as there is no direct method or function for it, it seems. But I have a
>> report I created programatically through the web services. Now I want to
>> set
>> up a history snapshot schedule for it, I already have schedules set up
>> on
>> the server as shared schedules, but now I need to tie them to the report
>> to
>> have them execute according to the schedule. Any ideas on how to do this?
>> Google wasnt much help to me in finding info. thanks!
>>