ÔõÑùÖƶ¨×Ô¼ºµÄSQL Server 2000´¥·¢Æ÷
´´½¨Ò»¸ö¼òµ¥µÄ´¥·¢Æ÷
´¥·¢Æ÷ÊÇÒ»ÖÖÌØÊâµÄ´æ´¢¹ý³Ì£¬ÀàËÆÓÚʼþº¯Êý£¬SQL Server? ÔÊÐíΪ INSERT¡¢UPDATE¡¢DELETE ´´½¨´¥·¢Æ÷£¬¼´µ±ÔÚ±íÖвåÈë¡¢¸üС¢É¾³ý¼Ç¼ʱ£¬´¥·¢Ò»¸ö»òһϵÁÐ T-SQLÓï¾ä¡£
´¥·¢Æ÷¿ÉÒÔÔÚ²éѯ·ÖÎöÆ÷Àï´´½¨£¬Ò²¿ÉÒÔÔÚ±íÃûÉϵãÓÒ¼ü->“ËùÓÐÈÎÎñ”->“¹ÜÀí´¥·¢Æ÷”À´´´½¨£¬²»¹ý¶¼ÊÇҪд T-SQL Óï¾äµÄ£¬Ö»ÊÇÔÚ²éѯ·ÖÎöÆ÷ÀïÒªÏÈÈ·¶¨µ±Ç°²Ù×÷µÄÊý¾Ý¿â¡£
´´½¨´¥·¢Æ÷Óà CREATE TRIGGER
CREATE TRIGGER ´¥·¢Æ÷Ãû³Æ
ON ±íÃû
FOR INSERT¡¢UPDATE »ò DELETE
AS
T-SQL Óï¾ä
×¢Ò⣺´¥·¢Æ÷Ãû³ÆÊDz»¼ÓÒýºÅµÄ¡£
ÈçÏÂÊÇÁª»ú´ÔÊéÉϵÄÒ»¸öʾÀý£¬µ±ÔÚ titles ±íÉϸü¸Ä¼Ç¼ʱ£¬·¢ËÍÓʼþ֪ͨ MaryM¡£
CREATE TRIGGER reminder
ON titles
FOR INSERT, UPDATE, DELETE
AS
EXEC master..xp_sendmail 'MaryM',
'Don''t forget to print a report for the distributors.'
ÖØÃüÃû´¥·¢Æ÷
Óòéѯ·ÖÎöÆ÷ÖØÃüÃû£º
exec sp_rename ÔÃû³Æ, ÐÂÃû³Æ
sp_rename ÊÇ SQL Server? ×Ô´øµÄÒ»¸ö´æ´¢¹ý³Ì£¬ÓÃÓÚ¸ü¸Äµ±Ç°Êý¾Ý¿âÖÐÓû§´´½¨µÄ¶ÔÏóµÄÃû³Æ£¬Èç±íÃû¡¢ÁÐ±í¡¢Ë÷ÒýÃûµÈ¡£
ÓÃÆóÒµ¹ÜÀíÆ÷ÖØÃüÃû£º
ÔÚ±íÉϵãÓÒ¼ü->“ËùÓÐÈÎÎñ”->“¹ÜÀí´¥·¢Æ÷”£¬Ñ¡ÖÐËùÒªÖØÃüÃûµÄ´¥·¢Æ÷£¬Ð޸Ĵ¥·¢Æ÷Óï¾äÖеĴ¥·¢Æ÷Ãû³Æ£¬µã»÷“È·¶¨”¡£
ɾ³ý´¥·¢Æ÷
Óòéѯ·ÖÎöÆ÷ɾ³ý£º
ÔÚ²éѯ·ÖÎöÆ÷ÖÐʹÓà drop trigger ´¥·¢Æ÷Ãû³Æ À´É¾³ý´¥·¢Æ÷¡£
Ò²¿ÉÒÔͬʱɾ³ý¶à¸ö´¥·¢Æ÷£ºdrop trigger ´¥·¢Æ÷Ãû³Æ,´¥·¢Æ÷Ãû³Æ...
×¢Ò⣺´¥·¢Æ÷Ãû³ÆÊDz»¼ÓÒýºÅµÄ¡£ÔÚɾ³ý´¥·¢Æ÷֮ǰ¿ÉÒÔÏÈ¿´Ò»Ï´¥·¢Æ÷ÊÇ·ñ´æÔÚ£º
if Exists(select name from sysobjects where name=´¥·¢Æ÷Ãû³Æ and xtype='TR')
ÓÃÆóÒµ¹ÜÀíÆ÷ɾ³ý£º
ÔÚÆóÒµ¹ÜÀíÆ÷ÖУ¬ÔÚ±íÉϵãÓÒ¼ü->“ËùÓÐÈÎÎñ”->“¹ÜÀí´¥·¢Æ÷”£¬Ñ¡ÖÐËùҪɾ³ýµÄ´¥·¢Æ÷£¬È»ºóµã»÷“ɾ³ý”¡£
ÈçºÎ²é¿´Ä³¸ö´¥·¢Æ÷µÄÄÚÈÝ
Óòéѯ·ÖÎöÆ÷²é¿´:
use Êý¾Ý¿âÃû
go
exec sp_helptext '´¥·¢Æ÷Ãû³Æ'
½«»áÒÔ±íµÄÑùʽÏÔʾ´¥·¢Æ÷ÄÚÈÝ¡£
³ýÁË´¥·¢Æ÷Í⣬sp_helptext »¹¿ÉÒÔÏÔʾ ¹æÔò¡¢Ä¬ÈÏÖµ¡¢Î´¼ÓÃܵĴ洢¹ý³Ì¡¢Óû§¶¨Ò庯Êý¡¢ÊÓͼµÄÎı¾¡£
ÓÃÆóÒµ¹ÜÀíÆ÷²é¿´£º
ÔÚ±íÉϵãÓÒ¼ü->“ËùÓÐÈÎÎñ”->“¹ÜÀí´¥·¢Æ÷”£¬Ñ¡ÔñËùÒª²é¿´µÄ´¥·¢Æ÷¡£
ÈçºÎ²é¿´µ±Ç°Êý¾Ý¿âÖÐÓÐÄÄЩ´¥·¢Æ÷
ÔÚ²éѯ·ÖÎöÆ÷ÖÐÔËÐУº
use Êý¾Ý¿âÃû
go
select * from syso
Ïà¹ØÎĵµ£º
MS SQLµÄһЩ¾µä³£ÓòÙ×÷Óï¾ä»ã×Ü ¡¾http://hi.baidu.com/kychen88/blog/item/b3c8e7d960821b3c32fa1cee.html¡¿
1.°´ÐÕÊϱʻÅÅÐò:
Select * from TableName Order By CustomerName Collate Chinese_PRC_Stroke_ci_as
2.Êý¾Ý¿â¼ÓÃÜ:
select encrypt('ÔʼÃÜÂë')
select pwdencrypt('ÔʼÃÜÂë')
select pwdcomp ......
Äܼà¿ØSQL ServerÊý¾Ý¿âÔËÐеÄÇé¿ö£¬¶Ô·þÎñÆ÷À´Ëµ¶¼ÊÇÒ»¼þ·Ç³£ÖØÒªµÄÊ£¬ÏÂÃ濪ʼ½éÉÜ¡£
Microsoft SQL Server 2005 ÌṩÁËһЩ¹¤¾ßÀ´¼à¿ØÊý¾Ý¿â¡£·½·¨Ö®Ò»ÊǶ¯Ì¬¹ÜÀíÊÓͼ¡£¶¯Ì¬¹ÜÀíÊÓͼ (DMV) ºÍ¶¯Ì¬¹ÜÀíº¯Êý (DMF) ·µ»ØµÄ·þÎñÆ÷״̬ÐÅÏ¢¿ÉÓÃÓÚ¼à¿Ø·þÎñÆ÷ʵÀýµÄÔËÐÐ×´¿ö¡¢Õï¶ÏÎÊÌâºÍÓÅ»¯ÐÔÄÜ¡£
³£¹æ·þÎñÆ÷¶¯Ì¬¹ÜÀí¶ÔÏó°ü ......
ÒªÇ󣺲éѯÿ¸öÀÏʦËù´ø±ÏÒµÉè¼ÆµÄ»ã×ÜÇé¿ö£¬±ÏÒµÉè¼ÆѧÉú·Ö±¾¿Æ¡¢×¨¿Æ£¬ÔºÍâ¡¢ÔºÄÚ£¬ÒªÇóµÃµ½µÄ½á¹ûÐÎʽÈçÏ£º
½ÌʦÃû ÔºÄÚ±¾¿Æ Ô°ÄÚר¿Æ ÔºÍâ±¾¿Æ ÔºÍâר¿Æ ºÏ¼Æ
Ïà¹ØµÄ±íÓУºÑ§Éú±í£¨°üº¬Ñ§Éú²ã´Î£©¡¢½Ìʦ±í£¨½ÌʦÃû£©¡¢Ñ§Éú¿ÎÌâ±í£¨Ñ§Éú½Ìʦ¶ÔÓ¦¹ØϵÒÔ¼°ÔºÄÚÔºÍâÐÅÏ¢£©¡£
SQLÓï¾äÈçÏ£º
select
  ......
2¡¢sql express °²×° Èç¹ûÔÚXPÏ£¬Ö±½ÓË«»÷°²×°¾ÍºÃÁË¡£ ÏÈ°²×° [ÔÚvistaÏÂÈç¹ûÖ±½ÓË«»÷¿ÉÄÜ»á³öÏÖ °²×°sql server express ³ö´í29506 ] [Vista°²×°µÄʱºò£¬ÐèҪʹÓá°ÒÔ¹ÜÀíÔ±Éí·ÝÔËÐС±°²×°] SQLServer2005_SSMSEE.msi°²×°½áÊø studioÒѾ°²×°ÉÏÈ¥£¬µ«ÊÇÄãÓÐûÓз¢ÏÖ£¬°²×°sqlµÄʱºòûÓз¢ÏÖÓÐÓû§saµÄà ......
°²×°Íê±ÏÖ®ºó£¬»¹ÐèÒªÉèÖÃһϲÅÄÜʹsql·þÎñÁ´½Ó³É¹¦¡£ Ñ¡ÔñµÚÒ»¸ö£º·þÎñºÍÁ´½ÓµÄÍâΧӦÓÃÅäÖÃÆ÷ µã»÷¡°Ô¶³ÌÁ´½Ó¡±£¬ÔÙÑ¡Ôñ±¾µØÁ´½ÓºÍÔ¶³ÌÁ´½Ó¡£Ñ¡ÔñµÚ3¸öÑ¡Ïî¡£ ºÃÁË¡£ÎÒÃÇ¿ÉÒÔµ½¿ªstudioÁË¡£ ¼ÇµÃÔÚ·þÎñÆ÷Ãû³ÆÊäÈ룺localhost\SQLEXPRESS
µÇ¼Ãûsa¡£ÃÜÂë¾ÍÊÇ°²×°µÄʱºòÊäÈëµÄÃÜÂë¡£ ok¡£¡£¡£ºÃÁË¡£¡£¡£¡ ......