sql ¸üÐÂÓï¾ä ¹ØÁªÁ½Õűí
sql Á½±í¹ØÁª ¸üÐÂ
update set from Óï¾ä¸ñʽ
SybaseºÍSQL SERVER£ºUPDATE...SET...from...WHERE...µÄÓï·¨£¬Êµ¼ÊÉÏ´ÓÔ´±í»ñÈ¡¸üÐÂÊý¾Ý¡£
ÔÚ SQL ÖУº
Update A SET A.dept =B.name
from A LEFT JOIN B ON B.ID=A.dept_ID
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
Transact SQL Óï ¾ä ¹¦ ÄÜ
========================================================================
¡¡¡¡--Êý¾Ý²Ù×÷
¡¡¡¡ SELECT --´ÓÊý¾Ý¿â±íÖмìË÷Êý¾ÝÐкÍÁÐ
¡¡¡¡¡¡¡¡¡¡¡¡INSERT --ÏòÊý¾Ý¿â±íÌí¼ÓÐÂÊý¾ÝÐÐ
¡¡¡¡¡¡¡¡¡¡¡¡DELETE --´ÓÊý¾Ý¿â±íÖÐɾ³ýÊý¾ÝÐÐ
¡¡¡¡¡¡¡¡¡¡¡¡UPDATE --¸üÐÂÊý¾Ý¿â±íÖеÄÊý¾Ý ......
×Ö·û´®º¯Êý¶Ô¶þ½øÖÆÊý¾Ý¡¢×Ö·û´®ºÍ±í´ïʽִÐв»Í¬µÄÔËËã¡£´ËÀຯÊý×÷ÓÃÓÚCHAR¡¢
VARCHAR¡¢ BINARY¡¢ ºÍVARBINARY Êý¾ÝÀàÐÍÒÔ¼°¿ÉÒÔÒþʽת»»ÎªCHAR »òVARCHARµÄ
Êý¾ÝÀàÐÍ¡£¿ÉÒÔÔÚSELECT Óï¾äµÄSELECT ºÍWHERE ×Ó¾äÒÔ¼°±í´ïʽÖÐʹÓÃ×Ö·û´®º¯Êý¡£³£ÓõÄ
×Ö·û´®º¯ÊýÓУº
Ò»¡¢×Ö·ûת»»º¯Êý
1¡¢ASCII()
·µ»Ø×Ö·û±í´ïʽ×î×ó¶ ......
ÏÂÃæÊÇSql Server ºÍ Access ²Ù×÷Êý¾Ý¿â½á¹¹µÄ³£ÓÃSql£¬Ï£Íû¶ÔÄãÓÐËù°ïÖú¡£
н¨±í£º
create table [±íÃû]
(
[×Ô¶¯±àºÅ×Ö¶Î] int IDENTITY (1,1) PRIMARY KEY ,
[×Ö¶Î1] nVarChar(50) default \'ĬÈÏÖµ\' null ,
[×Ö¶Î2] ntext null ,
[×Ö¶Î3] datetime,
[×Ö¶Î4] money null ,
[×Ö¶Î5] int default 0,
[×Ö¶Î6] De ......
[SQL SERVER] ¿ç·þÎñÆ÷²éѯ
[SQL SERVER] ¿ç·þÎñÆ÷²éѯ
·½·¨Ò»:
ÓÃOPENDATASOURCE
ÏÂÃæÊǸö¿çSQLServer²éѯµÄʾÀý
Select TableA.*,TableB.* from OPENDATASOURCE(
'SQLOLEDB',
'Data Source=ServerA;User ID ......