Showing posts with label process. Show all posts
Showing posts with label process. Show all posts

Monday, March 26, 2012

Retriveing the process ID for a SQL Server Agent job being run

We have created a SQL Server Job called 'Asynchronous Batch Agent'
which is run Asynchronously on a set of databases each containing a
batch.
What I would like to do is to retrieve the Process ID of a particular
instance of this agent when its being called and write that to a table
with the ID for the individual database.
Im having little luck at finding this information. I look at sp_who2
and sysprocesses...but get a link to the job.
Thanks for your help on this
ChrisHi Chris,
Try @.@.spid, db_id() and db_name().
Hope this helps,
Ben Nevarez
"chris.asaipillai@.gmail.com" wrote:
> We have created a SQL Server Job called 'Asynchronous Batch Agent'
> which is run Asynchronously on a set of databases each containing a
> batch.
> What I would like to do is to retrieve the Process ID of a particular
> instance of this agent when its being called and write that to a table
> with the ID for the individual database.
> Im having little luck at finding this information. I look at sp_who2
> and sysprocesses...but get a link to the job.
> Thanks for your help on this
> Chris
>

Retriveing the process ID for a SQL Server Agent job being run

We have created a SQL Server Job called 'Asynchronous Batch Agent'
which is run Asynchronously on a set of databases each containing a
batch.
What I would like to do is to retrieve the Process ID of a particular
instance of this agent when its being called and write that to a table
with the ID for the individual database.
Im having little luck at finding this information. I look at sp_who2
and sysprocesses...but get a link to the job.
Thanks for your help on this
Chris
Hi Chris,
Try @.@.spid, db_id() and db_name().
Hope this helps,
Ben Nevarez
"chris.asaipillai@.gmail.com" wrote:

> We have created a SQL Server Job called 'Asynchronous Batch Agent'
> which is run Asynchronously on a set of databases each containing a
> batch.
> What I would like to do is to retrieve the Process ID of a particular
> instance of this agent when its being called and write that to a table
> with the ID for the individual database.
> Im having little luck at finding this information. I look at sp_who2
> and sysprocesses...but get a link to the job.
> Thanks for your help on this
> Chris
>

Monday, March 12, 2012

retrieving BCP number of rows process

Thank you in advance
I am trying to retrieve the number of row that BCP process upon
completion,also how to find out what errors have occured when using the BCP
command.
thank you
tomasHi Tomas,
BCP is designed in a way that you cannot have all the functions in it. but
then they work pretty fast.
Since its not mentioned in your post, I am gonna assume that you are doing a
bcp OUT to a text file.
you can specify the maximum number of acceptable error in your bcp command.
In addition to that if you are coding all this in QA using xp_cmdshell you
can also create say something like balancing file to report the count(*) of
how many records you bcp.
It would be be interesting to know (from others) if you can actually count
the number of rows returned in bcp. As far as i know, there is no direct way
of doing it.
Hope this helps
ABhishek
"Tomas" wrote:

> Thank you in advance
> I am trying to retrieve the number of row that BCP process upon
> completion,also how to find out what errors have occured when using the BC
P
> command.
> thank you
> tomas|||Hi tomas,
In addition to what i wrote earlier today, I would suggest you to use the
following
declare @.someCommand
set @.someCommand = 'bcp "Select blah blah" queryout "c:/whatever place"
-U<userID> -P<pass> -c
exec master..xp_cmdshell @.somecommand
When u run it thru QA you will get some output as
"Starting copy....
XXXX rows sucessfully bulk-copies to host file, Total received: XXXX
XXXX rows copied
Network Packet size (byted) : xxxxx
clock time(ms.) total xxxx
"
Then going forward you can also specify the maximum acceptable errors in
your bcp command line.
Does it helps ' Do let me know if there was something else that you wanted
to acheive.
Abhishek
"Tomas" wrote:

> Thank you in advance
> I am trying to retrieve the number of row that BCP process upon
> completion,also how to find out what errors have occured when using the BC
P
> command.
> thank you
> tomas

Friday, March 9, 2012

Retrieving and sorting millions of rows

Hello,
Currently we are in the process of implementing a sql server database where couple tables will have millions of rows ( about 98 millions and will grow) and a web site that will retrieve and sort the data ( read only). How asp.net gridview and sqldatareader act situation like that? Will it be a very slow response? Is there any alternative? Is there any example on the net?

Assuming tables are well tuned and well indexed.

Thank you in advance.

How many of the rows will be displayed in the gridView? (Just an estimate). If there are going to be millions of rows, your best bet will be to implement SQL server side paging of the data. See below:

For use in SQL Server 2005 ONLY
http://www.davidhayden.com/blog/dave/archive/2005/12/30/2652.aspx

For use in SQL Server 2000 and prior versions
http://www.aspfaqs.com/webtech/041206-1.shtml

|||

The search result can bring not less than 5000.

|||

I would definitely look into doing server side paging. If you don't do the paging on the server, the ENTIRE result set will have to be transferred over the wire. Even though the gridView handles paging, it will still pull the entire set. With a large result set, the performance will be horrible.

|||

I think you answered the wrong question.

I think he wanted to know how many records would be displayed on the grid at one time, which isn't necessarily the same thing as the number of records that qualify according to your search criteria.

If you try to display 5000 rows of data (assuming we aren't talking a simple integer per row) at one time, the slowdown will be in the page rendering, not the data access.