Hi There,
Who know how to detect active connection to a particular SQL Server?
Eg: I have a SQL Server named MyServer and there are 3 computers link to
MyServer when my application start, but how do I know which of the 3
computers is linked to MyServer when application is running?
Thanks!
Wallace Wong
A2000 Solutions Pte Ltd
Blk 5 Ang Mo Kio Industrial Park 2A #07-17 TECH II Singapore 567760
Tel: (65) 6720 2000 Fax: (65) 6720 2987
Hi,
you can query the following objects:
SQL SERVER 2000:
SELECT * FROM sysprocesses
SQL SERVER 2005:
SELECT * FROM sys.dm_exec_sessions
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
|||"wallace" <wallace@.a2000.net> wrote in message
news:O7X575BUHHA.496@.TK2MSFTNGP06.phx.gbl...
> Hi There,
> Who know how to detect active connection to a particular SQL Server?
> Eg: I have a SQL Server named MyServer and there are 3 computers link to
> MyServer when my application start, but how do I know which of the 3
> computers is linked to MyServer when application is running?
>
> Thanks!
> --
> Wallace Wong
> A2000 Solutions Pte Ltd
> Blk 5 Ang Mo Kio Industrial Park 2A #07-17 TECH II Singapore 567760
> Tel: (65) 6720 2000 Fax: (65) 6720 2987
>
|||select count(*) from dbo.sysprocesses where status<>'Background'
EggHeadCafe.com - .NET Developer Portal of Choice
http://www.eggheadcafe.com
Showing posts with label link. Show all posts
Showing posts with label link. Show all posts
Monday, March 19, 2012
How to detect active connection of a SQL Server?
Hi There,
Who know how to detect active connection to a particular SQL Server?
Eg: I have a SQL Server named MyServer and there are 3 computers link to
MyServer when my application start, but how do I know which of the 3
computers is linked to MyServer when application is running?
Thanks!
Wallace Wong
A2000 Solutions Pte Ltd
Blk 5 Ang Mo Kio Industrial Park 2A #07-17 TECH II Singapore 567760
Tel: (65) 6720 2000 Fax: (65) 6720 2987Hi,
you can query the following objects:
SQL SERVER 2000:
SELECT * FROM sysprocesses
SQL SERVER 2005:
SELECT * FROM sys.dm_exec_sessions
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
--|||"wallace" <wallace@.a2000.net> wrote in message
news:O7X575BUHHA.496@.TK2MSFTNGP06.phx.gbl...
> Hi There,
> Who know how to detect active connection to a particular SQL Server?
> Eg: I have a SQL Server named MyServer and there are 3 computers link to
> MyServer when my application start, but how do I know which of the 3
> computers is linked to MyServer when application is running?
>
> Thanks!
> --
> Wallace Wong
> A2000 Solutions Pte Ltd
> Blk 5 Ang Mo Kio Industrial Park 2A #07-17 TECH II Singapore 567760
> Tel: (65) 6720 2000 Fax: (65) 6720 2987
>|||Hello,
Execute SP_WHO system stored procedure from SQL Server Management studio --
Query window (SQL 2005) or Query Analyzer in SQL 2000 to get
all the connections in SQL Server. This gives you the Hostname of the each
connection
Thanks
Hari
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message news:...
> "wallace" <wallace@.a2000.net> wrote in message
> news:O7X575BUHHA.496@.TK2MSFTNGP06.phx.gbl...
>
Who know how to detect active connection to a particular SQL Server?
Eg: I have a SQL Server named MyServer and there are 3 computers link to
MyServer when my application start, but how do I know which of the 3
computers is linked to MyServer when application is running?
Thanks!
Wallace Wong
A2000 Solutions Pte Ltd
Blk 5 Ang Mo Kio Industrial Park 2A #07-17 TECH II Singapore 567760
Tel: (65) 6720 2000 Fax: (65) 6720 2987Hi,
you can query the following objects:
SQL SERVER 2000:
SELECT * FROM sysprocesses
SQL SERVER 2005:
SELECT * FROM sys.dm_exec_sessions
HTH, Jens K. Suessmeyer.
http://www.sqlserver2005.de
--|||"wallace" <wallace@.a2000.net> wrote in message
news:O7X575BUHHA.496@.TK2MSFTNGP06.phx.gbl...
> Hi There,
> Who know how to detect active connection to a particular SQL Server?
> Eg: I have a SQL Server named MyServer and there are 3 computers link to
> MyServer when my application start, but how do I know which of the 3
> computers is linked to MyServer when application is running?
>
> Thanks!
> --
> Wallace Wong
> A2000 Solutions Pte Ltd
> Blk 5 Ang Mo Kio Industrial Park 2A #07-17 TECH II Singapore 567760
> Tel: (65) 6720 2000 Fax: (65) 6720 2987
>|||Hello,
Execute SP_WHO system stored procedure from SQL Server Management studio --
Query window (SQL 2005) or Query Analyzer in SQL 2000 to get
all the connections in SQL Server. This gives you the Hostname of the each
connection
Thanks
Hari
"Hari Prasad" <hari_prasad_k@.hotmail.com> wrote in message news:...
> "wallace" <wallace@.a2000.net> wrote in message
> news:O7X575BUHHA.496@.TK2MSFTNGP06.phx.gbl...
>
How to design link tables?
I have been having a similar discussion on the MS Access newsgroup for the
last w
and I wanted to discuss the issues in the context of MS SQL in
addition to MS Access. I hope this form of cross posting is not offensive to
anyone.
Lets assume I have to relations: student and course and I want to create a
junction table to record which students are taking which courses.
(1) If I create a two column table containing fkStudent and fkCourse where
the primary consists of these two columns. Now I want to perform a join to
find out all the courses a particular student is taking. Since the primary
key index structure requires both foreign keys and I'm only providing the
value for fkStudent and not fkCourse, will I be preforming a linear search
on the junction table when I preform a join to determine what courses I am
taking?
My guess is yes. If your answer is yes, would you anticipate a linear search
to be a problem? I would. If you agree that we should avoid linear searches,
then what would you recommend for a primary key on this link table? Do we
need a pimary key at all? Most folks say yes -- but I'm not clear on why.
(2) Lets say I have many thousands of job titles -- too many for a combo
box. I want to have a M:M relationship between Job Titles and Job Postings.
Let's say I find a job posting on the web and I need to find the foriegn key
for a job title (if it exists) or create a job title (if it does not exist).
I can assume it does not exist and try an SQL INSERT and, if that fails, use
a SELECT. Or, I can assume it does exist and use SELECT and if I don't find
any, use INSERT. Either way, the worst case scenerio requires two redundant
lookups. Is there a better approach?
Thanks,
SiegfriedHi
1) Look at [Order Details] table in Northwind database.
It is a "junction table" between Orders and Product tables.
2)
IF NOT EXISTS (SELECT * FROM Table WHERE....)
INSERT INTO ......
ELSE
SELECT <columns> FROM ......
"Siegfried Heintze" <siegfried@.heintze.com> wrote in message
news:%23ofWEqlsFHA.460@.TK2MSFTNGP15.phx.gbl...
>I have been having a similar discussion on the MS Access newsgroup for the
> last w
and I wanted to discuss the issues in the context of MS SQL in
> addition to MS Access. I hope this form of cross posting is not offensive
> to
> anyone.
> Lets assume I have to relations: student and course and I want to create a
> junction table to record which students are taking which courses.
> (1) If I create a two column table containing fkStudent and fkCourse where
> the primary consists of these two columns. Now I want to perform a join to
> find out all the courses a particular student is taking. Since the primary
> key index structure requires both foreign keys and I'm only providing the
> value for fkStudent and not fkCourse, will I be preforming a linear search
> on the junction table when I preform a join to determine what courses I am
> taking?
> My guess is yes. If your answer is yes, would you anticipate a linear
> search
> to be a problem? I would. If you agree that we should avoid linear
> searches,
> then what would you recommend for a primary key on this link table? Do we
> need a pimary key at all? Most folks say yes -- but I'm not clear on why.
> (2) Lets say I have many thousands of job titles -- too many for a combo
> box. I want to have a M:M relationship between Job Titles and Job
> Postings.
> Let's say I find a job posting on the web and I need to find the foriegn
> key
> for a job title (if it exists) or create a job title (if it does not
> exist).
> I can assume it does not exist and try an SQL INSERT and, if that fails,
> use
> a SELECT. Or, I can assume it does exist and use SELECT and if I don't
> find
> any, use INSERT. Either way, the worst case scenerio requires two
> redundant
> lookups. Is there a better approach?
> Thanks,
> Siegfried
>
last w
addition to MS Access. I hope this form of cross posting is not offensive to
anyone.
Lets assume I have to relations: student and course and I want to create a
junction table to record which students are taking which courses.
(1) If I create a two column table containing fkStudent and fkCourse where
the primary consists of these two columns. Now I want to perform a join to
find out all the courses a particular student is taking. Since the primary
key index structure requires both foreign keys and I'm only providing the
value for fkStudent and not fkCourse, will I be preforming a linear search
on the junction table when I preform a join to determine what courses I am
taking?
My guess is yes. If your answer is yes, would you anticipate a linear search
to be a problem? I would. If you agree that we should avoid linear searches,
then what would you recommend for a primary key on this link table? Do we
need a pimary key at all? Most folks say yes -- but I'm not clear on why.
(2) Lets say I have many thousands of job titles -- too many for a combo
box. I want to have a M:M relationship between Job Titles and Job Postings.
Let's say I find a job posting on the web and I need to find the foriegn key
for a job title (if it exists) or create a job title (if it does not exist).
I can assume it does not exist and try an SQL INSERT and, if that fails, use
a SELECT. Or, I can assume it does exist and use SELECT and if I don't find
any, use INSERT. Either way, the worst case scenerio requires two redundant
lookups. Is there a better approach?
Thanks,
SiegfriedHi
1) Look at [Order Details] table in Northwind database.
It is a "junction table" between Orders and Product tables.
2)
IF NOT EXISTS (SELECT * FROM Table WHERE....)
INSERT INTO ......
ELSE
SELECT <columns> FROM ......
"Siegfried Heintze" <siegfried@.heintze.com> wrote in message
news:%23ofWEqlsFHA.460@.TK2MSFTNGP15.phx.gbl...
>I have been having a similar discussion on the MS Access newsgroup for the
> last w
> addition to MS Access. I hope this form of cross posting is not offensive
> to
> anyone.
> Lets assume I have to relations: student and course and I want to create a
> junction table to record which students are taking which courses.
> (1) If I create a two column table containing fkStudent and fkCourse where
> the primary consists of these two columns. Now I want to perform a join to
> find out all the courses a particular student is taking. Since the primary
> key index structure requires both foreign keys and I'm only providing the
> value for fkStudent and not fkCourse, will I be preforming a linear search
> on the junction table when I preform a join to determine what courses I am
> taking?
> My guess is yes. If your answer is yes, would you anticipate a linear
> search
> to be a problem? I would. If you agree that we should avoid linear
> searches,
> then what would you recommend for a primary key on this link table? Do we
> need a pimary key at all? Most folks say yes -- but I'm not clear on why.
> (2) Lets say I have many thousands of job titles -- too many for a combo
> box. I want to have a M:M relationship between Job Titles and Job
> Postings.
> Let's say I find a job posting on the web and I need to find the foriegn
> key
> for a job title (if it exists) or create a job title (if it does not
> exist).
> I can assume it does not exist and try an SQL INSERT and, if that fails,
> use
> a SELECT. Or, I can assume it does exist and use SELECT and if I don't
> find
> any, use INSERT. Either way, the worst case scenerio requires two
> redundant
> lookups. Is there a better approach?
> Thanks,
> Siegfried
>
Subscribe to:
Posts (Atom)