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

MSSQLÊý¾Ý¿â±¸·Ý

1
¡¢
MSSQL
Êý¾Ý¿âµÄ¶¨ÆÚ×Ô¶¯±¸·Ý¼Æ»®
 
ͨ¹ýÆóÒµ¹ÜÀíÆ÷
ÉèÖÃÊý¾Ý¿âµÄ¶¨ÆÚ×Ô¶¯±¸·Ý¼Æ»®¡£
1
¡¢´ò¿ªÆóÒµ¹Ü
ÀíÆ÷£¬Ë«»÷´ò¿ªÄãµÄ·þÎñÆ÷
2
¡¢È»ºóµãÉÏÃæ
²Ëµ¥ÖеŤ¾ß
-->
Ñ¡ÔñÊý¾Ý¿âά»¤¼Æ»®Æ÷
3
¡¢ÏÂÒ»²½Ñ¡ÔñÒª½øÐÐ×Ô¶¯±¸·ÝµÄÊý¾Ý
-->
ÏÂÒ»²½¸üÐÂÊý¾ÝÓÅ»¯ÐÅÏ¢£¬ÕâÀïÒ»°ã²»ÓÃ×öÑ¡Ôñ
-->
ÏÂÒ»²½¼ì²éÊý¾ÝÍêÕûÐÔ£¬Ò²Ò»°ã²»Ñ¡Ôñ
4
¡¢ÏÂÒ»²½Ö¸¶¨Êý¾Ý¿âά»¤¼Æ»®£¬Ä¬ÈϵÄÊÇ
1
Öܱ¸·ÝÒ»´Î£¬µã»÷¸ü¸ÄÑ¡Ôñ±¸·ÝµÄÈÕÆÚ¼°Ê±¼äµã
È·¶¨
,
5
¡¢ÏÂÒ»²½Ö¸¶¨
±¸·ÝµÄ´ÅÅÌĿ¼£¬Ñ¡ÔñÖ¸¶¨Ä¿Â¼£¬È»ºóÑ¡Ôñɾ³ýÔçÓÚ¶àÉÙÌìǰµÄ±¸·Ý£¬Ñ¡ÔñÒ»¸öÐÇÆÚɾ³ýÒ»´Î±¸·Ý
,
¾ßÌ屸·Ý¿´ÄãµÄÒªÇ󣬱¸·ÝÎļþÀ©Õ¹ÃûĬÈϵÄÊÇ
BAK
6
¡¢ÏÂÒ»²½Ö¸¶¨ÊÂÎñÈÕÖ¾±¸·Ý¼Æ»®£¬¿´ÄãµÄÐèÒª×öÑ¡Ôñ
-->
ÏÂÒ»²½ÒªÉú³ÉµÄ±¨±í£¬Ò»°ã²»×öÑ¡Ôñ
-->
ÏÂÒ»²½Î¬»¤¼Æ»®ÀúÊ·¼Ç¼£¬×îºÃÓÃĬÈϵÄÑ¡Ïî
-->
ÏÂÒ»²½Íê³É
7
¡¢Íê³ÉºóϵͳºÜ¿ÉÄÜ»áÌáʾ
Sql
Server Agent
·þÎñδÆô¶¯£¬ÏȵãÈ·¶¨Íê³É¼Æ»®É趨£¬È»ºóÕÒµ½×ÀÃæ×îÓÒ±ß״̬À¸ÖеÄ
SQL
ÂÌɫͼ±ê£¬Ë«»÷µã¿ª£¬ÔÚ·þÎñÖÐÑ¡Ôñ
Sql
Server Agent
£¬È»ºóµã»÷ÔËÐмýÍ·£¬Ñ¡ÉÏÏ·½µÄµ±Æô¶¯
OS
ʱ×Ô¶¯Æô¶¯·þÎñ
8
¡¢¿ÉÒÔÉèÖÃÆô¶¯Æô¶¯
sql
server Agent:
ÔËÐÐ
Services.msc
£¬ÉèÖÃ
sqlserverAgent
Ϊ×Ô¶¯Æô¶¯¡£
2
¡¢
/*--
Êý¾Ý¿â
 

ÍêÈ«
+
ÔöÁ¿
(
²îÒì
)
±¸·Ý
/
»Ö¸´
 

ʾÀý
--*/
 
 
--
Çå³ý»·¾³
 
  exec   master..xp_cmdshell   'del  
c:\test.bak'  
  if   exists(select   *   from  
master..sysdatabases   where   name='test')  
  drop   database  
test  
  go  
   
  --
´´½¨Êý¾Ý¿â
 
  create   database   test  
  go  
 
 
  --
´ò¿ª´´½¨µÄÊý¾Ý
 

  use   test  
  go  
   
  --
´´½¨²âÊÔ±í
 
  create   table   t(a   int)  
   
 
--
Çл»»Ø
master
Êý¾Ý¿â
 
  use   master  
  go  
   
 
--
²åÈëÊý¾Ý
1  


Ïà¹ØÎĵµ£º

ubuntuÖÐÁ¬½ÓmssqlÊý¾Ý¿â

»ù±¾Ô­Àí
FreeTDSΪLinuxϵͳÌṩÁËTDSЭÒéµÄ¿ªÔ´¿Í»§¶Ë¡£ÓÉÓÚMS SQLºÍSybaseʹÓõÄÇ¡ÊÇTDSЭÒ飬ËùÒÔÔÚLinuxÖпÉÒÔÓÃFreeTDSÁ¬½ÓMS SQL¡£
ÎÒÃÇ¿ÉÒÔÀûÓÃOpenOffice.Org Base¼°Linux ODBCʵÏÖ¿ÉÊÓ»¯µÄÊý¾Ý¿â²é¿´·½Ê½¡£·½±ã¸öÈËÓû§Ê¹ÓÃLinuxÔ¶³Ì¹ÜÀí×Ô¼ºµÄÊý¾Ý¿âϵͳ¡£
ÃüÁîÐз½Ê½Ê¹Ó÷½·¨¼ò½é
°²×°FreeTDSºÍsqsh
Ê×ÏȰ ......

mssqlÖÐÓÃxmlµÄ·½·¨²ð·ÖÒÔ²»¶¨¿Õ¸ñΪ·Ö¸î·ûºÅµÄ×Ö·û´®

---xml²ð·ÖÒÔ²»¶¨¿Õ¸ñΪ·Ö¸î·ûºÅµÄ×Ö·û´®
--²âÊÔÊý¾Ý
if object_id('[tb]') is not null drop table [tb]
create table [tb]([a] varchar(200))
go
insert [tb]
select 'aaaa  bbbb cccc        dddd'
insert [tb]
select 'eeeeee  ffff hhhh     ......

Ö÷Á÷Êý¾Ý¿âMYSQL/MSSQL/ORACLE²âÊÔÊý¾Ý¿â½Å±¾´úÂë


/******************************************************************************/
/*
Ö÷Á÷Êý¾Ý¿âMYSQL/MSSQL/ORACLE²âÊÔÊý¾Ý¿â½Å±¾´úÂë
½Å±¾ÈÎÎñ:½¨Á¢4¸ö±í,Ìí¼ÓÖ÷¼ü,Íâ¼ü£¬²åÈëÊý¾Ý,½¨Á¢ÊÓͼ
ÔËÐл·¾³1:microsoft sqlserver 2000 ²éѯ·ÖÎöÆ÷
ÔËÐл·¾³2:mysql5.0 phpMyAdminÍøÒ³½çÃæ
ÔËÐл·¾³3:oracle 9i SQL*P ......

mssql´æ´¢¹ý³ÌÓï·¨Ïê½â£¨±¸Íü£©


Óï·¨
CREATE PROC[ EDURE ] [ owner. ] procedure_name [ ; number ] 
    [ { @parameter data_type } 
        [ VARYING ] [ = default ] [ OUTPUT ] 
   &n ......

MSSQLµÄ¶à²ãǶÌײéѯ

½ñÌìÔÚÁÄÌìϵͳÖÐÐèҪϵͳִÐÐÒ»¸ö¶à²ãǶÌײéѯ¡£
Ò»¿ªÊ¼Óï¾äÈçÏÂ×ܳöÏÖ´íÎó£ºÔ­À´ÊÇÔÚ]='123') ºóÎÒ¶à¼ÓÁËÒ»¸ö as tb1
¸ÄΪÈçϺó£¬ÕýÈ·ÔËÐС£
select * from ( select top(10)  * from ( select top(100)  * from (select  [chatcontent].[senderid],[chatcontent].[id] ,[chatcontent].[toid] ,[chatc ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ