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

ÐÞ¸ÄSQL SERVERÊý¾Ý¿â±í½á¹¹µÄSQLÃüÁî

¡¡¡¡Ïò±íÖÐÔö¼ÓÒ»¸ö varchar ÁУº
¡¡¡¡ALTER TABLE distributors ADD COLUMN address varchar(30);
¡¡¡¡´Ó±íÖÐɾ³ýÒ»¸ö×ֶΣº
¡¡¡¡ALTER TABLE distributors DROP COLUMN address RESTRICT;
¡¡¡¡ÔÚÒ»¸ö²Ù×÷ÖÐÐÞ¸ÄÁ½¸öÏÖÓÐ×ֶεÄÀàÐÍ£º
¡¡¡¡ALTER TABLE distributors
¡¡¡¡ALTER COLUMN address TYPE varchar(80),
¡¡¡¡ALTER COLUMN name TYPE varchar(100);
¡¡¡¡Ê¹ÓÃÒ»¸ö USING ×Ӿ䣬 °ÑÒ»¸ö°üº¬ UNIX ʱ¼ä´ÁµÄ integer ×Ö¶Îת»¯³É timestamp with time zone£º
¡¡¡¡ALTER TABLE foo
¡¡¡¡ALTER COLUMN foo_timestamp TYPE timestamp with time zone
¡¡¡¡USING
¡¡¡¡timestamp with time zone 'epoch' + foo_timestamp * interval '1 second';
¡¡¡¡¶ÔÏÖ´æ×ֶθÄÃû£º
¡¡¡¡ALTER TABLE distributors RENAME COLUMN address TO city;
¡¡¡¡¸ü¸ÄÏÖ´æ±íµÄÃû×Ö£º
¡¡¡¡ALTER TABLE distributors RENAME TO suppliers;
¡¡¡¡¸øÒ»¸ö×Ö¶ÎÔö¼ÓÒ»¸ö·Ç¿ÕÔ¼Êø£º
¡¡¡¡ALTER TABLE distributors ALTER COLUMN street SET NOT NULL;
¡¡¡¡´ÓÒ»¸ö×Ö¶ÎÀïɾ³ýÒ»¸ö·Ç¿ÕÔ¼Êø£º
¡¡¡¡ALTER TABLE distributors ALTER COLUMN street DROP NOT NULL;
¡¡¡¡¸øÒ»¸ö±íÔö¼ÓÒ»¸ö¼ì²éÔ¼Êø£º
¡¡¡¡ALTER TABLE distributors ADD CONSTRAINT zipchk CHECK (char_length(zipcode) = 5);
¡¡¡¡É¾³ýÒ»¸ö±íºÍËüµÄËùÓÐ×Ó±íµÄ¼à²éÔ¼Êø£º
¡¡¡¡ALTER TABLE distributors DROP CONSTRAINT zipchk;
¡¡¡¡Ïò±íÖÐÔö¼ÓÒ»¸öÍâ¼üÔ¼Êø£º
¡¡¡¡ALTER TABLE distributors ADD CONSTRAINT distfk FOREIGN KEY (address) REFERENCES addresses(address) MATCH FULL;
¡¡¡¡¸ø±íÔö¼ÓÒ»¸ö£¨¶à×ֶΣ©Î¨Ò»Ô¼Êø£º
¡¡¡¡ALTER TABLE distributors ADD CONSTRAINT dist_id_zipcode_key UNIQUE (dist_id, zipcode);
¡¡¡¡¸øÒ»¸ö±íÔö¼ÓÒ»¸ö×Ô¶¯ÃüÃûµÄÖ÷¼üÔ¼Êø£¬Òª×¢ÒâµÄÊÇÒ»¸ö±íÖ»ÄÜÓÐÒ»¸öÖ÷¼ü£º
¡¡¡¡ALTER TABLE distributors ADD PRIMARY KEY (dist_id);
¡¡¡¡°Ñ±íÒÆ¶¯µ½ÁíÍâÒ»¸ö±í¿Õ¼ä£º
¡¡¡¡ALTER TABLE distributors SET TABLESPACE fasttablespace;
from: http://www.cnblogs.com/liulanglang/archive/2009/03/09/1406674.html


Ïà¹ØÎĵµ£º

¹ØÓÚSql PromptÆÆ½âµÄ·½·¨

ǰ²»¾Ã¿´µ½Í¬ÊÂÔÚÓÃSql Prompt3.9£¬¾õµÃÂù·½±ãµÄ¡£¸øÎÒÃÇд³ÌÐòÄÜʡϲ»ÉÙÁ¦Æø¡£·½±ã£¬sql´úÂë¿´ÆðÀ´ÓÖ¼ò½é¡£ÖµµÃÍÆ¼ö¡£http://www.red-gate.com/ÕâÊÇËüµÄ¹ÙÍø£¬ÊÇÒ»¿îÊշѵÄÈí¼þ¡£Õýʽ°æ±¾ÏÂÔØÏÂÀ´Ö»ÄÜʹÓÃ14Ìì¡£·Ï»°²»ËµÁË£¬ÏÈ¿´ÏÂЧ¹ûͼ£º
»¹²»´í°¡¡£
½ÓÏÂÀ´½éÉÜÏÂÆÆ½âµÄ·½·¨£¬Ïȵ½¹ÙÍø°Ñ×îаæ(ÏÖÔÚÒѾ­ÊÇ3.9ÁË)ÏÂÏÂÀ ......

SQL Server ÄêÔÂÈÕ¼ÆËã

SQL Server 2000/2005 ÄêÔÂÈÕ¼ÆËã·½·¨
ͨ³££¬ÄãÐèÒª»ñµÃµ±Ç°ÈÕÆÚºÍ¼ÆËãһЩÆäËûµÄÈÕÆÚ£¬ÀýÈ磬ÄãµÄ³ÌÐò¿ÉÄÜÐèÒªÅжÏÒ»¸öÔµĵÚÒ»Ìì»òÕß×îºóÒ»Ìì¡£ÄãÃÇ´ó²¿
·ÖÈË´ó¸Å¶¼ÖªµÀÔõÑù°ÑÈÕÆÚ½øÐзָÄê¡¢Ô¡¢Èյȣ©£¬È»ºó½ö½öÓ÷ָî³öÀ´µÄÄê¡¢Ô¡¢ÈյȷÅÔÚ¼¸¸öº¯ÊýÖмÆËã³ö×Ô¼ºËùÐèÒªµÄÈÕÆÚ£¡ÔÚÕâÆªÎÄÕÂÀÎÒ½«¸æËßÄã
ÈçºÎÊ¹Ó ......

ÐÐÁÐתÖõÄSQLÓï¾ä

ÐÐÁÐתÖõÄSQLÓï¾ä
ÁíÒ»ÖÖÐÐÁÐתÖà -- ¶¯Ì¬ sql ½»²æ±í =========================================================== ×÷Õß: wxy0327(http://wxy0327.itpub.net)
·¢±íÓÚ: 2006.05.10 09:11
·ÖÀà: Oracle
³ö´¦: http://wxy0327.itpub.net/post/16888/88075
-------------------------- ......

ÎÒÏëÓÃÒ»ÌõSQLÏÔʾÕâÑùµÄ½á¹û

²»ÖªµÀÕâÑùµÄÒªÇóÄܲ»ÄÜʵÏÖ£¿
±ÈÈçÎÒÓÐÒ»ÕűíT1£¬ÀïÃæÖ»ÓÐÒ»¸ö×Ö¶Î1
ÀïÃæÓÐ100Ìõ¼Ç¼£¬ÈçÏÂËùʾ£º
×Ö¶Î1
A1
A2
A3
A4
...
A100
ÎÒÏëÓÃÒ»ÌõSQLÏÔʾÕâÑùµÄ½á¹û
µÚÒ»ÁР   µÚ¶þÁР   ...        µÚÊ®ÁÐ
A1        A11    &nb ......

SQL °´Ô²éѯ

ÏîÄ¿ÖÐÐèÒª¸ù¾Ý¿Î¼þÃû³Æ°´ÔÂͳ¼Æ³ö·ÃÎʵÄÇé¿ö£¬µÚÒ»´ÎÎÒ²ÉÓÃÁË×îÍÁµÄÒ»ÖÖ°ì·¨£¬Ê¹ÓÃÑ­»·£¬¸øsql´«µÝÄêÔÂÁ½¸ö²ÎÊý£¬
for(var y=2009;y<=2010;y++){
    for(var m=1;m<=12;m++){
          // todo : SQL ²éѯ
    }
}
ÕâÑù£¬Í³¼Æ2 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ