In SQLServer 2005, how can you select just the processes that are
connected to a specific database? In 2000, I could do it with this
query:
select *
from sysprocesses
where dbid = 5
BOL recommends using any of the dynamic management views
sys.dm_exec_connections, sys.dm_exec_sessions, or sys.dm_exec_requests
as a replacement for sysprocesses, but none of these has a database or
dbid column that I can find. Am I overlooking something? How do you
do this? Thanks.select * from sys.dm_exec_requests
where database_id = 5
to just see who is using a database, who might not be running any queries,
you can use sys.dm_tran_locks
select request_session_id from sys.dm_tran_locks
where resource_type = 'DATABASE'
and resource_database_id = 5
--
HTH
Kalen Delaney, SQL Server MVP
http://sqlblog.com
<stavros@.mailinator.com> wrote in message
news:1161904818.742946.108590@.m7g2000cwm.googlegroups.com...
> In SQLServer 2005, how can you select just the processes that are
> connected to a specific database? In 2000, I could do it with this
> query:
> select *
> from sysprocesses
> where dbid = 5
> BOL recommends using any of the dynamic management views
> sys.dm_exec_connections, sys.dm_exec_sessions, or sys.dm_exec_requests
> as a replacement for sysprocesses, but none of these has a database or
> dbid column that I can find. Am I overlooking something? How do you
> do this? Thanks.
>sql
Showing posts with label sqlserver. Show all posts
Showing posts with label sqlserver. Show all posts
Wednesday, March 28, 2012
Replacement for sysprocesses dbid?
In SQLServer 2005, how can you select just the processes that are
connected to a specific database? In 2000, I could do it with this
query:
select *
from sysprocesses
where dbid = 5
BOL recommends using any of the dynamic management views
sys.dm_exec_connections, sys.dm_exec_sessions, or sys.dm_exec_requests
as a replacement for sysprocesses, but none of these has a database or
dbid column that I can find. Am I overlooking something? How do you
do this? Thanks.select * from sys.dm_exec_requests
where database_id = 5
to just see who is using a database, who might not be running any queries,
you can use sys.dm_tran_locks
select request_session_id from sys.dm_tran_locks
where resource_type = 'DATABASE'
and resource_database_id = 5
HTH
Kalen Delaney, SQL Server MVP
http://sqlblog.com
<stavros@.mailinator.com> wrote in message
news:1161904818.742946.108590@.m7g2000cwm.googlegroups.com...
> In SQLServer 2005, how can you select just the processes that are
> connected to a specific database? In 2000, I could do it with this
> query:
> select *
> from sysprocesses
> where dbid = 5
> BOL recommends using any of the dynamic management views
> sys.dm_exec_connections, sys.dm_exec_sessions, or sys.dm_exec_requests
> as a replacement for sysprocesses, but none of these has a database or
> dbid column that I can find. Am I overlooking something? How do you
> do this? Thanks.
>
connected to a specific database? In 2000, I could do it with this
query:
select *
from sysprocesses
where dbid = 5
BOL recommends using any of the dynamic management views
sys.dm_exec_connections, sys.dm_exec_sessions, or sys.dm_exec_requests
as a replacement for sysprocesses, but none of these has a database or
dbid column that I can find. Am I overlooking something? How do you
do this? Thanks.select * from sys.dm_exec_requests
where database_id = 5
to just see who is using a database, who might not be running any queries,
you can use sys.dm_tran_locks
select request_session_id from sys.dm_tran_locks
where resource_type = 'DATABASE'
and resource_database_id = 5
HTH
Kalen Delaney, SQL Server MVP
http://sqlblog.com
<stavros@.mailinator.com> wrote in message
news:1161904818.742946.108590@.m7g2000cwm.googlegroups.com...
> In SQLServer 2005, how can you select just the processes that are
> connected to a specific database? In 2000, I could do it with this
> query:
> select *
> from sysprocesses
> where dbid = 5
> BOL recommends using any of the dynamic management views
> sys.dm_exec_connections, sys.dm_exec_sessions, or sys.dm_exec_requests
> as a replacement for sysprocesses, but none of these has a database or
> dbid column that I can find. Am I overlooking something? How do you
> do this? Thanks.
>
Labels:
areconnected,
database,
dbid,
microsoft,
mysql,
oracle,
processes,
replacement,
select,
server,
specific,
sql,
sqlserver,
sysprocesses,
thisqueryselect
Monday, March 26, 2012
Replace substring
Hello
Need to replace text_A with text_B contained within 2 columns of table., SQL
server 2000.
table name = stock
column names = description and long_description
Thanks for any help
Regards
Maxwellmaxbrit wrote:
> Need to replace text_A with text_B contained within 2 columns of
> table., SQL server 2000.
> table name = stock
> column names = description and long_description
update stock set description = replace(description, 'text_A',
'text_B'), long_description = replace(long_description, 'text_A',
'text_B'),
HTH,
Stijn Verrept.|||Many thanks for quick reply.
Merry Christmas and a Happy New Year.
"Stijn Verrept" <TURN_moc.tfosyrtne@.njits_AROUND> wrote in message
news:IdydnaFpC_7QajrenZ2dnUVZ8qWdnZ2d@.sc
arlet.biz...
> maxbrit wrote:
>
> update stock set description = replace(description, 'text_A',
> 'text_B'), long_description = replace(long_description, 'text_A',
> 'text_B'),
> --
> HTH,
> Stijn Verrept.
Need to replace text_A with text_B contained within 2 columns of table., SQL
server 2000.
table name = stock
column names = description and long_description
Thanks for any help
Regards
Maxwellmaxbrit wrote:
> Need to replace text_A with text_B contained within 2 columns of
> table., SQL server 2000.
> table name = stock
> column names = description and long_description
update stock set description = replace(description, 'text_A',
'text_B'), long_description = replace(long_description, 'text_A',
'text_B'),
HTH,
Stijn Verrept.|||Many thanks for quick reply.
Merry Christmas and a Happy New Year.
"Stijn Verrept" <TURN_moc.tfosyrtne@.njits_AROUND> wrote in message
news:IdydnaFpC_7QajrenZ2dnUVZ8qWdnZ2d@.sc
arlet.biz...
> maxbrit wrote:
>
> update stock set description = replace(description, 'text_A',
> 'text_B'), long_description = replace(long_description, 'text_A',
> 'text_B'),
> --
> HTH,
> Stijn Verrept.
Friday, March 23, 2012
REPLACE Oracle function in SQLServer 2000
Hi everyone. I'm currently migrating our system from Oracle to SQLServer. How can I switch the REPLACE Oracle function? Is there any function in SQLServer that do the same thing, or any function that has something near the REPLACE? I was trying the STUFF function, but it uses different parameters, and the migration will be stuff(something like 18k of SQL lines :( ).
Thanks in advance and Best Regards
Rafael Mauricio Nami
Have you had a look at replace?|||Thanks, I've got the wrong SQLServer book :)
Thanks in advance and Best Regards
Rafael Mauricio Nami
Have you had a look at replace?|||Thanks, I've got the wrong SQLServer book :)
Subscribe to:
Posts (Atom)