Showing posts with label determine. Show all posts
Showing posts with label determine. Show all posts

Monday, March 26, 2012

How to get the REAL host name?

Hello:
I need to be able to determine the name of the client machine running the
session. The value in sysprocesses.hostname is client-supplied, so it may be
not the real name of the client machine. The client can explicitly specify
any host name in the ADO connection string. Is there a way to find out the
real host name? Perhaps from the network adapter address, which is also in
sysprocesses?
This problem is especially apparent for MS Access projects (adp's); they
always connect with the host name being the name of the developer's machine.
thanks,
VadimYou tocuhed on the answer... I'm sure there's a way to get it from the MAC
address. I just don't know TCP enough to tell you how...
but there's nothing else that could definitiely tell you. As you point
out... the client can put anything it wants int he string...
--
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Vadim Rapp" <vr@.myrealbox.nospam.com> wrote in message
news:u5zReG7rDHA.1760@.TK2MSFTNGP10.phx.gbl...
> Hello:
> I need to be able to determine the name of the client machine running the
> session. The value in sysprocesses.hostname is client-supplied, so it may
be
> not the real name of the client machine. The client can explicitly specify
> any host name in the ADO connection string. Is there a way to find out the
> real host name? Perhaps from the network adapter address, which is also in
> sysprocesses?
> This problem is especially apparent for MS Access projects (adp's); they
> always connect with the host name being the name of the developer's
machine.
> thanks,
> Vadim
>|||Depending on the architecture of TDS, which I'm not sure of, the MAC address
may not be the client's host NIC anyway, usually MAC address is the address
of the client NIC or the nearest router NIC whichever is logically closer on
the network.
But, it you want to assume MAC=MAC of Client NIC, you could write a routine
to parse the output of ARP -a
Kevin Connell, MCDBA
----
The views expressed here are my own
and not of my employer.
----
"Brian Moran" <brian@.solidqualitylearning.com> wrote in message
news:uC#7f47rDHA.3552@.TK2MSFTNGP11.phx.gbl...
> You tocuhed on the answer... I'm sure there's a way to get it from the MAC
> address. I just don't know TCP enough to tell you how...
> but there's nothing else that could definitiely tell you. As you point
> out... the client can put anything it wants int he string...
> --
> Brian Moran
> Principal Mentor
> Solid Quality Learning
> SQL Server MVP
> http://www.solidqualitylearning.com
>
> "Vadim Rapp" <vr@.myrealbox.nospam.com> wrote in message
> news:u5zReG7rDHA.1760@.TK2MSFTNGP10.phx.gbl...
> > Hello:
> >
> > I need to be able to determine the name of the client machine running
the
> > session. The value in sysprocesses.hostname is client-supplied, so it
may
> be
> > not the real name of the client machine. The client can explicitly
specify
> > any host name in the ADO connection string. Is there a way to find out
the
> > real host name? Perhaps from the network adapter address, which is also
in
> > sysprocesses?
> >
> > This problem is especially apparent for MS Access projects (adp's); they
> > always connect with the host name being the name of the developer's
> machine.
> >
> > thanks,
> >
> > Vadim
> >
>

Wednesday, March 7, 2012

How to get number of records returned by a data set?

Hi,
I am looking for a way to determine a number of records returned by my
dataset. The ultimate goal is to hide a table and dispaly informative
message, in case there are no records returned. This should be fairly
simple, but I can't seem to figure out how to get it. Thank you in advance!
MichaelYou can get it using the Count function. The sintaxis is:
=Count(Fields!some_field.Value, "Your_dataset")
You can use this to display the number of rows of a data set in a textbox.
You can also use it as a condition inside an IFF clause:
=IIF(Count(Fields!some_field.Value, "Your_dataset") = 0, action1, action2)
I hope this helps|||Works like a charm! Thank you very much!
- Michael

Sunday, February 19, 2012

How to get from JobID back to SubscriptionID

Hi!
I am hoping someone can explain how I can determine the subscription
associated with a currently running job (report). If a report is misbehaving,
we would like to determine the subscription that initiated the report
running. We can cancel the job to stop the report from running this time, but
we would like to be able to prevent it from running again.
I believe that this would mean tieing the jobid back to a subscriptionid,
but I have not been able to determine a way either programatically or via a
direct query of the RS tables to determine this.
Any help would be greatly appreciated.
Thanks in advance,
BobHello,
This is what I do:
--This will help you identify the OID of the report
SELECT ItemID, Path
FROM Catalog
--This will show all subscriptions for the report
SELECT *
FROM Subscriptions
WHERE Report_OID = '[ItemID from previous query]'
--This will tell you the job id
SELECT *
FROM ReportSchedule
WHERE SubscriptionID = '[SubscriptionID from the previous query]'
You can put all together, but I prefer to run them one by one because I have
a lot of reports and also several subscriptions per report.
Hope this helps.
Ricardo.
"bobhug" wrote:
> Hi!
> I am hoping someone can explain how I can determine the subscription
> associated with a currently running job (report). If a report is misbehaving,
> we would like to determine the subscription that initiated the report
> running. We can cancel the job to stop the report from running this time, but
> we would like to be able to prevent it from running again.
> I believe that this would mean tieing the jobid back to a subscriptionid,
> but I have not been able to determine a way either programatically or via a
> direct query of the RS tables to determine this.
> Any help would be greatly appreciated.
> Thanks in advance,
> Bob|||Ricardo,
Thanks for the response.
I do not see how this gets me to JobID however.
SELECT *
FROM ReportSchedule
WHERE SubscriptionID = '[SubscriptionID from the previous query]'
This would give me scheduleid and reportid, but I still do not know how to
get to jobid.
Perhaps I am just missing something.
Thanks,
Bob
"Ricardo Sampei" wrote:
> Hello,
> This is what I do:
> --This will help you identify the OID of the report
> SELECT ItemID, Path
> FROM Catalog
> --This will show all subscriptions for the report
> SELECT *
> FROM Subscriptions
> WHERE Report_OID = '[ItemID from previous query]'
> --This will tell you the job id
> SELECT *
> FROM ReportSchedule
> WHERE SubscriptionID = '[SubscriptionID from the previous query]'
> You can put all together, but I prefer to run them one by one because I have
> a lot of reports and also several subscriptions per report.
> Hope this helps.
> Ricardo.
> "bobhug" wrote:
> > Hi!
> > I am hoping someone can explain how I can determine the subscription
> > associated with a currently running job (report). If a report is misbehaving,
> > we would like to determine the subscription that initiated the report
> > running. We can cancel the job to stop the report from running this time, but
> > we would like to be able to prevent it from running again.
> > I believe that this would mean tieing the jobid back to a subscriptionid,
> > but I have not been able to determine a way either programatically or via a
> > direct query of the RS tables to determine this.
> > Any help would be greatly appreciated.
> >
> > Thanks in advance,
> > Bob|||Hello Bob,
Probably you have already figured out thi one, but anyway, here is the
answer: What you get in ScheduleID from ReportSchedule is the job name in SQL
Server Agent.
Ricardo.
"bobhug" wrote:
> Ricardo,
> Thanks for the response.
> I do not see how this gets me to JobID however.
> SELECT *
> FROM ReportSchedule
> WHERE SubscriptionID = '[SubscriptionID from the previous query]'
> This would give me scheduleid and reportid, but I still do not know how to
> get to jobid.
> Perhaps I am just missing something.
> Thanks,
> Bob
> "Ricardo Sampei" wrote:
> > Hello,
> >
> > This is what I do:
> > --This will help you identify the OID of the report
> > SELECT ItemID, Path
> > FROM Catalog
> >
> > --This will show all subscriptions for the report
> > SELECT *
> > FROM Subscriptions
> > WHERE Report_OID = '[ItemID from previous query]'
> >
> > --This will tell you the job id
> > SELECT *
> > FROM ReportSchedule
> > WHERE SubscriptionID = '[SubscriptionID from the previous query]'
> >
> > You can put all together, but I prefer to run them one by one because I have
> > a lot of reports and also several subscriptions per report.
> >
> > Hope this helps.
> >
> > Ricardo.
> >
> > "bobhug" wrote:
> >
> > > Hi!
> > > I am hoping someone can explain how I can determine the subscription
> > > associated with a currently running job (report). If a report is misbehaving,
> > > we would like to determine the subscription that initiated the report
> > > running. We can cancel the job to stop the report from running this time, but
> > > we would like to be able to prevent it from running again.
> > > I believe that this would mean tieing the jobid back to a subscriptionid,
> > > but I have not been able to determine a way either programatically or via a
> > > direct query of the RS tables to determine this.
> > > Any help would be greatly appreciated.
> > >
> > > Thanks in advance,
> > > Bob|||Ricardo,
Hi!
Now I understand the confusion.
The JobID I was referring to is the one as found in the RunningJobs table
and the Job class: http://tinyurl.com/9zyb2 , which is different than what
you are talking about, the name of the SQL Server agent job.
Thanks for responding,
Bob
"Ricardo Sampei" wrote:
> Hello Bob,
> Probably you have already figured out thi one, but anyway, here is the
> answer: What you get in ScheduleID from ReportSchedule is the job name in SQL
> Server Agent.
> Ricardo.
> "bobhug" wrote:
> > Ricardo,
> >
> > Thanks for the response.
> > I do not see how this gets me to JobID however.
> > SELECT *
> > FROM ReportSchedule
> > WHERE SubscriptionID = '[SubscriptionID from the previous query]'
> > This would give me scheduleid and reportid, but I still do not know how to
> > get to jobid.
> >
> > Perhaps I am just missing something.
> > Thanks,
> > Bob
> >
> > "Ricardo Sampei" wrote:
> >
> > > Hello,
> > >
> > > This is what I do:
> > > --This will help you identify the OID of the report
> > > SELECT ItemID, Path
> > > FROM Catalog
> > >
> > > --This will show all subscriptions for the report
> > > SELECT *
> > > FROM Subscriptions
> > > WHERE Report_OID = '[ItemID from previous query]'
> > >
> > > --This will tell you the job id
> > > SELECT *
> > > FROM ReportSchedule
> > > WHERE SubscriptionID = '[SubscriptionID from the previous query]'
> > >
> > > You can put all together, but I prefer to run them one by one because I have
> > > a lot of reports and also several subscriptions per report.
> > >
> > > Hope this helps.
> > >
> > > Ricardo.
> > >
> > > "bobhug" wrote:
> > >
> > > > Hi!
> > > > I am hoping someone can explain how I can determine the subscription
> > > > associated with a currently running job (report). If a report is misbehaving,
> > > > we would like to determine the subscription that initiated the report
> > > > running. We can cancel the job to stop the report from running this time, but
> > > > we would like to be able to prevent it from running again.
> > > > I believe that this would mean tieing the jobid back to a subscriptionid,
> > > > but I have not been able to determine a way either programatically or via a
> > > > direct query of the RS tables to determine this.
> > > > Any help would be greatly appreciated.
> > > >
> > > > Thanks in advance,
> > > > Bob