SQL ServerÖеÄÔ¼ÊøÌõ¼þ
1.ĬÈÏÔ¼Êø£º¶¨Òå¸ÃÁÐδÊäÈëֵʱӦ¸Ã¾ßÓеÄĬÈÏÖµ
SQL-------alter table ±íÃû add constraint dt_ÁÐÃû default ĬÈÏÖµ for ÁÐÃû
2.¿ÕÖµÔ¼Êø£º¶¨Òå¸ÃÁÐÊÇ·ñÔÊÐíΪ¿ÕÖµ
SQL-------¶¨Òå±íµÄʱºòÔÚ¶ÔÓ¦ÁÐÁÐÊý¾ÝÀàÐͺóÃæÌí¼Ónot null
3.¼ì²éÔ¼Êø£ºÓÖ½ÐcheckÔ¼Êø£¬ÓÃÀ´ÏÞÖÆÁеÄÈ¡Öµ£¬Ëü¸ù¾Ý¶¨ÒåµÄÂß¼±í´ïʽÀ´Ç¿ÖÆÓòµÄÍêÕûÐÔ
SQL-------alter table ±íÃû add constraint ck_ÁÐÃû check(Âß¼±í´ïʽ)
4.ΨһԼÊø£ºÈ·±£ÔÚ·ÇÖ÷¼üÁв»ÊäÈëÖظ´Öµ
SQL-------alter table ±íÃû add constraint uq_ÁÐÃû unique[clustered | nonclustered](ÁÐÃû)
5.Íâ¼üÔ¼Êø£ºÓÃÓÚ½¨Á¢Á½¸ö±íÊý¾ÝÖ®¼äÁ¬½ÓµÄÒ»Áлò¶àÁÐ
SQL-------alter table ±íÃû add constraint fk_ÁÐÃû foreign key(ÁÐÃû) references ÁíÒ»±íÃû(ÁÐÃû)
6.Ö÷¼üÔ¼Êø£ºÓÃÀ´Î©Ò»µØ±êʶ±íÖеÄÿһÐÐ
SQL-------alter table ±íÃû add constraint pk_ÁÐÃû primary key(ÁÐÃû)
ÐÂÔöÁУºalter table ±íÃû add ÐÂÁÐÃû Êý¾ÝÀàÐÍ
ɾ³ýÁУºalter table ±íÃû drop column ÁÐÃû
ɾ³ýÔ¼Êø£ºalter table ±íÃû drop constraint Ô¼ÊøÃû
ÐÞ¸ÄÁÐÊý¾ÝÀàÐÍ£ºalter table ±íÃû alter column ÁÐÃû ÐÂÊý¾ÝÀàÐÍ
ÐÞ¸ÄÁÐÃûÐèÒªµ÷Óô洢¹ý³Ìsp_rename
Ïà¹ØÎĵµ£º
sql²éѯÖÐÏÔʾÐòºÅ
2009-06-04 09:27
/* ·½·¨Ò»*/
SELECTÐòºÅ= (SELECT COUNT(¿Í»§±àºÅ) from ¿Í»§ AS LiMing
WHERE LiMing.¿Í»§±àºÅ<= Chang.¿Í»§±àºÅ),
¿Í»§±àºÅ,¹«Ë¾Ãû³Æ
from¿Í»§ AS Chang ORDER BY 1;
G ......
ËùνÌìÏ´óÊ£¬·Ö¾Ã±ØºÏ£¬ºÏ¾Ã±Ø·Ö£¬¶ÔÓÚ·ÖÇø±í¶øÑÔÒ²Ò»Ñù¡£Ç°ÃæÎÒÃǽéÉܹýÈçºÎɾ³ý£¨ºÏ²¢£©·ÖÇø±íÖеÄÒ»¸ö·ÖÇø£¬ÏÂÃæÎÒÃǽéÉÜÒ»ÏÂÈçºÎΪ·ÖÇø±íÌí¼ÓÒ»¸ö·ÖÇø¡£
Ϊ·ÖÇø±íÌí¼ÓÒ»¸ö·ÖÇø£¬ÕâÖÖÇé¿öÊÇʱ³£»á
·¢ÉúµÄ¡£±ÈÈ磬×î³õÔÚÊý¾Ý¿âÉè¼Æʱ£¬Ö»Ô¤¼ÆÁË´æ·Å3ÄêµÄÊý¾Ý£¬¿ÉÊǵ½Á˵Ú4ÌìÔõ ......
<%
set conn=server.createobject("adodb.connection")
conn.connectionstring="PROVIDER=MSDASQL;DRIVER={SQL Server};SERVER=210.76.209.130;DATABASE=databasename;UID=sa;PWD=password;"
conn.open
%>
ÆäÖÐ 210.76.209.130 ¾ÍÊÇÔ¶³Ì·þÎñÆ÷µÄIP
¶þ¡¢ÎÒÓÃVBдÁ˸ö¹ÜÀíÈí¼þ,²¢²ÉÈ¡PINGÔ¶³Ì·þÎñÆ÷ÓòÃûµÄ ......
Ëæ×ÅB/SģʽӦÓÿª·¢µÄ·¢Õ¹£¬Ê¹ÓÃÕâÖÖģʽ±àдӦÓóÌÐòµÄ³ÌÐòÔ±Ò²Ô½À´Ô½¶à¡£µ«ÊÇÓÉÓÚ³ÌÐòÔ±µÄˮƽ¼°¾ÑéÒ²²Î²î²»Æ룬Ï൱´óÒ»²¿·Ö³ÌÐòÔ±ÔÚ±àд´úÂëµÄʱºò£¬Ã»ÓжÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ½øÐÐÅжϣ¬Ê¹Ó¦ÓóÌÐò´æÔÚ°²È«Òþ»¼¡£Óû§¿ÉÒÔÌá½»Ò»¶ÎÊý¾Ý¿â²éѯ´úÂ룬¸ù
¾Ý³ÌÐò·µ»ØµÄ½á¹û£¬»ñµÃijЩËûÏëµÃÖªµÄÊý¾Ý£¬Õâ¾ÍÊÇËùνµÄS ......
Ëæ×ÅB/SģʽӦÓÿª·¢µÄ·¢Õ¹£¬Ê¹ÓÃÕâÖÖģʽ±àдӦÓóÌÐòµÄ³ÌÐòÔ±Ò²Ô½À´Ô½¶à¡£µ«ÊÇÓÉÓÚÕâ¸öÐÐÒµµÄÈëÃÅÃż÷²»¸ß£¬³ÌÐòÔ±µÄˮƽ¼°¾ÑéÒ²²Î²î²»Æ룬Ï൱´óÒ»²¿·Ö³ÌÐòÔ±ÔÚ±àд´úÂëµÄʱºò£¬Ã»ÓжÔÓû§ÊäÈëÊý¾ÝµÄºÏ·¨ÐÔ½øÐÐÅжϣ¬Ê¹Ó¦ÓóÌÐò´æÔÚ°²È«Òþ»¼¡£Óû§¿ÉÒÔÌá½»Ò»¶ÎÊý¾Ý¿â²éѯ´úÂ룬¸ù¾Ý³ÌÐò·µ»ØµÄ½á¹û£¬»ñµÃijЩËûÏëµÃÖªµÄÊ ......