sqlÓï¾ä
1. ˵Ã÷£º¸´ÖƱí(Ö»¸´Öƽṹ£¬Ô´±íÃû£ºa£¬Ð±íÃû£ºb)
SQL: select * into b from a where 1<>1;
2. ˵Ã÷£º¿½±´±í(¿½±´Êý¾Ý£¬Ô´±íÃû£ºa£¬Ä¿±ê±íÃû£ºb)
SQL: insert into b(a, b, c) select d, e, f from b;
3. ˵Ã÷£ºÏÔʾÎÄÕ¡¢Ìá½»È˺Í×îºó»Ø¸´Ê±¼ä
SQL: select a.title, a.username, b.adddate
from table a,(
select max(adddate) adddate
from table where table.title=a.title) b ¡¡
4. ˵Ã÷£ºÍâÁ¬½Ó²éѯ(±íÃû1£ºa£¬±íÃû2£ºb)
SQL: select a.a, a.b, a.c, b.c, b.d, b.f
from a LEFT OUT JOIN b ON a.a = b.c; ¡¡
5. ˵Ã÷£ºÈճ̰²ÅÅÌáÇ°Îå·ÖÖÓÌáÐÑ
SQL: select *
from Èճ̰²ÅÅ
where datediff(’’minute’’, f¿ªÊ¼Ê±¼ä, getdate())>5 ¡¡¡¡
¡¡¡¡
6. ˵Ã÷£ºÁ½ÕŹØÁª±í£¬É¾³ýÖ÷±íÖÐÒѾÔÚ¸±±íÖÐûÓеÄÐÅÏ¢
SQL: delete from info
where not exists(
select *
from infobz
where info.infid=infobz.infid );
7. ˵Ã÷£º——
SQL: SELECT A.NUM, A.NAME, B.UPD_DATE, B.PREV_UPD_DATE
from TABLE1,(SELECT X.NUM, X.UPD_DATE, Y.UPD_DATE PREV_UPD_DATE
from (SELECT NUM, UPD_DATE, INBOUND_QTY, STOCK_ONHAND
from TABLE2
&nb
Ïà¹ØÎĵµ£º
1 PLS_INTEGER
PLS_INTEGER¿ÉÒÔ´æ´¢Ò»¸öÓзûºÅµÄÕûÐÎÖµ£¬Æ侫¶È·¶Î§ºÍBINARY_INTEGERÒ»Ñù£¬ÊÇ£º-2^31~2^31¡£
PLS_INTEGERºÍNUMBER±È½ÏÆðÀ´£¬ÆäÓŵãÊÇ£º
1).Õ¼ÓнÏÉٵĴ洢¿Õ¼ä£»
2).¿ÉÒÔÖ±½Ó½øÐÐËãÊõÔËË㣨ÔÚNUMBERÉϲ»ÄÜÖ±½Ó½øÐÐËãÊõÔËË㣬Èç¹ûÒª¼ÆË㣬NUMBER±ØÐëÏȱ»×ª»»³É¶þ½øÖÆ£©¡£ËùÒÔÔÚ½øÐÐËãÊõµÄʱºòPLS_INTEGER ......
ÊìϤSQL SERVER 2000µÄÊý¾Ý¿â¹ÜÀíÔ±¶¼ÖªµÀ£¬ÆäDTS¿ÉÒÔ½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬Æäʵ£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃTransact-SQLÓï¾ä½øÐе¼Èëµ¼³ö²Ù×÷¡£ÔÚTransact-SQLÓï¾äÖУ¬ÎÒÃÇÖ÷ҪʹÓÃOpenDataSourceº¯Êý¡¢OPENROWSET º¯Êý£¬¹ØÓÚº¯ÊýµÄÏêϸ˵Ã÷£¬Çë²Î¿¼SQLÁª»ú°ïÖú¡£ÀûÓÃÏÂÊö·½·¨£¬¿ÉÒÔÊ®·ÖÈÝÒ×µØʵÏÖSQL SERVER¡¢ACCESS¡¢EXCELÊý¾ ......
¼òµ¥Ì¸»ùÓÚSQL SERVER ·ÖÒ³´æ´¢¹ý³ÌµÄÑݽø
×÷ÕߣºÖ£×ô
ÈÕÆÚ£º2006-9-30
Õë¶ÔÊý¾Ý¿âÊý¾ÝÔÚUI½çÃæÉϵķÖÒ³ÊÇÀÏÉú³£Ì¸µÄÎÊÌâÁË£¬ÍøÉϺÜÈÝÒ×ÕÒµ½¸÷Ö֓ͨÓô洢¹ý³Ì”´úÂ룬¶øÇÒÓÐЩ»¹¶¨ÖƲéѯÌõ¼þ£¬¿´ÉÏȥʹÓúܷ½±ã¡£±ÊÕß´òËãͨ¹ý±¾ÎÄÒ²À´¼òµ¥Ì¸Ò»Ï»ùÓÚSQL SERVER 2000µÄ·ÖÒ³´æ´¢¹ý³Ì£¬Í¬Ê±Ì¸Ì¸SQL SER ......
µ±ÄãÕýÔÚ´¦Àí±»¶à¸öÕ¾µã£¨ÏñÔÚ¿ç¹ú¹«Ë¾Ìõ¼þÏ£©Ê¹ÓõĴóÊý¾Ý¿âʱ£¬ÄãÒ²Ðí»áÓöµ½±£Ö¤±í¸ñ¶ÔÏóΨһÐÔÕâÑùµÄ¼¬ÊÖÎÊÌâ¡£ÔÚÕâÖÖÇéÐÎÏ£¬¿ÉÄÜÖ»ÄÜ¿¿UNIQUEIDENTIFIERÀ´½â¾ö¡£UNIQUEIDENTIFIERÊÇÒ»¸ö±£´æÈ«¾ÖΨһ±êʶ·ûµÄGUIDÊý¾ÝÀàÐÍ¡£GUIDÊÇÒ»¸ö±£Ö¤Î¨Ò»µÄ¶þ½øÖÆÊý£¬Òò´Ë¼¸ºõûÓбðµÄ¼ÆËã»ú»á²úÉúͬһ¸öÖµ¡£
GUIDµÄΨһֵÊÇÓÉ¼Æ ......
Ò»£ºC# Á¬½ÓSQLÊý¾Ý¿â
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Data Source=190.190.200.100,1433;Network Library=DBMSSOCN;Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;
Server=myServerAddress;Database=myDataBase;User ID=myUse ......