Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

sqlserver Êý¾Ý¿âËÀËøºó¶à³¤Ê±¼ä½âËø£¿

¸÷λ´óÏÀ£¬sqlserver Êý¾Ý¿âËÀËøºó£¬»á²»»á×Ô¶¯½âËøÄØ£¿¶à³¤Ê±¼äÄÜ×Ô¶¯½âËøÄØ£¿Ð»Ð»£¡
SQL code:
use master
go
create procedure sp_who_lock
as
begin
declare @spid int,@bl int,
@intTransactionCountOnEntry int,
@intRowcount int,
@intCountProperties int,
@intCounter int

create table #tmp_lock_who (
id int identity(1,1),
spid smallint,
bl smallint)

IF @@ERROR<>0 RETURN @@ERROR

insert into #tmp_lock_who(spid,bl) select 0 ,blocked
from (select * from sysprocesses where blocked>0 ) a
where not exists(select * from
(select * from sysprocesses where blocked>0 ) b
where a.blocked=spid)
union select spid,blocked from sysprocesses where blocked>0

IF @@ERROR<>0 RETURN @@ERROR

-- ÕÒµ½ÁÙʱ±íµÄ¼Ç¼Êý
select @intCountProperties = Count(*),@intCounter = 1
from #tmp_lock_who

IF @@ERROR<>0 RETURN @@ERROR

if @intCountProperties=0
select 'ÏÖÔÚûÓÐ×èÈûºÍËÀËøÐÅÏ¢' as message

-- Ñ­»·¿ªÊ¼
while @intCounter <= @intCountProperties
begin
-- È¡µÚÒ»Ìõ¼Ç¼
select @spid = spid,@bl = bl
from #tmp_lock_who where Id = @intCounter
begin
if @spid =0
select 'ÒýÆðÊý¾Ý¿âËÀËøµÄÊÇ: '+ CAST(@bl AS VARCHAR(10))
+ '½ø³ÌºÅ,ÆäÖ´ÐеÄSQLÓï·¨ÈçÏÂ'
else
select '½ø³ÌºÅSPID£º'+ CAST(@spid AS VARCHAR(10))+ '±»'
+ '½ø³ÌºÅSPID£º'+ CAST(@bl AS VARCHAR(10)) +'×èÈû,Æäµ±
ǰ½ø³ÌÖ´ÐеÄSQLÓï·¨ÈçÏÂ'DBCC INPUTBUFFER
×Ô¼ºÊÔÏÂ
{{--


Ïà¹ØÎÊ´ð£º

ACCESS·±ÌåÁ¬½Ó¼òÌåsqlserver2000

  ÎÒµÄÊý¾Ý¿âÊǼòÌåsqlserver2000 ,ÎÒÏëÔÚ·±ÌåaccessÏÂÁ¬½Ó,ͨ¹ýodbcÊÇ¿ÉÒÔÁË,µ«ÔÚaccessϳöÏÖ´ò¿ªµÄ±íÈ«ÖÐ"#ÒÑɾ³ý"
²»ÖªµÀÒªÔõô²Ù×÷²Å¿ÉÒÔÓÃACCESS·±ÌåÁ¬½Ó¼òÌåsqlserver2000.лл!!!
´ó¼Ò¶¼ ......

SqlServer »ù´¡ÎÊÌâ

Ô­Êý¾Ý£º



¾­¹ý´ËsqlÓï¾ä²éѯ³öÀ´µÄ½á¹ûÊÇ£º
SQL code:
select Code, Name=stuff((select ','+Name from C t where Code=C.Code for xml path('')), 1, 1, '')
from C




¼ÓÉÏG ......

¹ØÓÚSQLSERVERµ×²ãÎÊÌâ - MS-SQL Server / ÒÉÄÑÎÊÌâ

ÇëÎÊһϣ¬ÍâÍøÁ½Ì¨SQLSERVERʵÀýÊý¾Ý´«Ê䣬ÓÐûÓвÉÓÃÊý¾ÝѹËõºÍ¼ÓÃÜ¡£Ñ¹Ëõ±ÈÊǶàÉÙ£¬¼ÓÃÜÊÇʲô¼ÓÃÜËã·¨£¿Ïà¹ØÎĵµÄÄÀï¿ÉÒÔÕÒµ½£¿Ð»Ð»


ÎÒÒ²ÏëÖªµÀ£¡¹Ø×¢´ËÌù£¡

¹Ø×¢¡«¡«

Êý¾Ý¿â´óÅ£¶¼ÄÄÈ¥Á˰¡£¿
......

sqlserver 1433¶Ë¿ÚµÄÎÊÌâ(ÕûÁËÒ»ÌìÎÞ¹û,¶¥Ò²ÓзÖ)

xp(sp3)ϵͳ°²×°ÁËsqlserver2000£¬sp3£¬sp4²¹¶¡¶¼´òÁË¡£¶øÇÒ±¾»úÒ²ÄÜÁ¬½Ó·ÃÎÊ¡£
ÎÊÌâÊÇ£º
±¾»útelnet ip 1433 ×ÜÊÇÌáʾÁ¬½Óʧ°Ü£¬
¶øÇÒnetstat -naʱ£¬¿´²»µ½1433¶Ë¿Ú±»Õ¼ÓÃ
(¿Ï¶¨µÄÊÇ£º¶Ë¿ÚÊÇ1433£¬¿ªÆ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ