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

ÈçºÎÕÒµ½sql serverÊý¾Ý¿âÖеÄËÀËø?


¼ì²âËÀËø
Èç¹û·¢ÉúËÀËøÁË£¬ÎÒÃÇÔõôȥ¼ì²â¾ßÌå·¢ÉúËÀËøµÄÊÇÄÄÌõSQLÓï¾ä»ò´æ´¢¹ý³Ì£¿
ÕâʱÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏ´洢¹ý³ÌÀ´¼ì²â£¬¾Í¿ÉÒÔ²é³öÒýÆðËÀËøµÄ½ø³ÌºÍSQLÓï¾ä¡£SQL Server×Ô´øµÄϵͳ´æ´¢¹ý³Ìsp_whoºÍsp_lockÒ²¿ÉÒÔÓÃÀ´²éÕÒ×èÈûºÍËÀËø, µ«Ã»ÓÐÕâÀï½éÉܵķ½·¨ºÃÓá£
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&nbs


Ïà¹ØÎĵµ£º

ÒªÌá¸ßSQL²éѯЧÂÊwhereÓï¾äÌõ¼þµÄÏȺó´ÎÐòÓ¦ÈçºÎд

ÎÒÃÇÒª×öµ½²»µ«»áдSQL£¬»¹Òª×öµ½Ð´³öÐÔÄÜÓÅÁ¼µÄSQLÓï¾ä¡£
£¨1£©Ñ¡Ôñ×îÓÐЧÂʵıíÃû˳Ðò(Ö»ÔÚ»ùÓÚ¹æÔòµÄÓÅ»¯Æ÷ÖÐÓÐЧ)£º
OracleµÄ½âÎöÆ÷°´ÕÕ´ÓÓÒµ½×óµÄ˳Ðò´¦Àífrom×Ó¾äÖеıíÃû£¬from×Ó¾äÖÐдÔÚ×îºóµÄ±í(»ù´¡±í driving
table)½«±»×îÏÈ´¦Àí£¬ÔÚfrom×Ó¾äÖаüº¬¶à¸ö±íµÄÇé¿öÏÂ,Äã±ØÐëÑ¡Ôñ¼Ç¼ÌõÊý×îÉٵıí×÷Ϊ»ù´¡±í¡£È ......

sql 2008 ¶ÔÔ¶³ÌÊý¾Ý¿âµÄ²Ù×÷

1£ºexec sp_addlinkedserver   'ITSV ', ' ', 'SQLOLEDB ', '192.168.*.12'
     exec sp_addlinkedsrvlogin 'ITSV ', 'false ',null, 'sa ', 'F00000'
2£º
EXEC sp_configure 'show advanced options', 1
GO
RECONFIGURE
GO
EXEC sp_configure 'Ad Hoc Distributed Queries', ......

SQL SERVER 2000/2005 ÁÐתÐÐ ÐÐתÁÐ


ÆÕͨÐÐÁÐת»»
ÎÊÌ⣺¼ÙÉèÓÐÕÅѧÉú³É¼¨±í(tb)ÈçÏÂ:
ÐÕÃû ¿Î³Ì ·ÖÊý
ÕÅÈý ÓïÎÄ 74
ÕÅÈý Êýѧ 83
ÕÅÈý ÎïÀí 93
ÀîËÄ ÓïÎÄ 74
ÀîËÄ Êýѧ 84
ÀîËÄ ÎïÀí 94
Ïë±ä³É(µÃµ½ÈçϽá¹û)£º
ÐÕÃû ÓïÎÄ Êýѧ ÎïÀí
---- ---- ---- ----
ÀîËÄ 74 84 94
ÕÅÈý 74 83 93
-------------------
*/
create table tb(ÐÕÃû varc ......

SQL ServerÓëOracle¡¢DB2µÄÐÔÄܱȽÏ

¿ª·ÅÐÔ ¡¡¡¡SQL Server
¡¡¡¡Ö»ÄÜÔÚWindows ÉÏÔËÐУ¬Ã»ÓÐË¿ºÁµÄ¿ª·ÅÐÔ£¬²Ù×÷ϵͳµÄϵͳµÄÎȶ¨¶ÔÊý¾Ý¿âÊÇÊ®·ÖÖØÒªµÄ¡£Windows9XϵÁвúÆ·ÊÇÆ«ÖØÓÚ×ÀÃæÓ¦Óã¬NT serverÖ»ÊʺÏÖÐСÐÍÆóÒµ¡£¶øÇÒWindowsƽ̨µÄ¿É¿¿ÐÔ£¬°²È«ÐÔºÍÉìËõÐÔÊǷdz£ÓÐÏ޵ġ£Ëü²»ÏóUnixÄÇÑù¾Ã¾­¿¼Ñ飬ÓÈÆäÊÇÔÚ´¦Àí´óÊý¾ÝÁ¿µÄ¹Ø¼üÒµÎñʱ¡£
¡¡¡¡Oracle ......

sql server´´½¨Êý¾Ý¿â½Å±¾

use master
go
--Çл»masterÊý¾Ý¿â
if exists(select 1 from sysdatabases where name = N'test')
--×¢Òâ¸ÃͬÃûÊý¾Ý¿âÊÇ·ñ»¹ÒªÓõ½
begin
drop database test
end
go
create database test
on
primary
( name = 'testprimary', --Ö÷Êý¾ÝÎļþÂß¼­Ãû
filename = 'D:\testprimary.mdf',--Ö÷Êý¾ÝÎļþ´æ·Å·¾¶
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ