SQL SERVER ÓëACCESS¡¢EXCELµÄÊý¾Ýת»»
ÊìϤSQL SERVER 2000µÄÊý¾Ý¿â¹ÜÀíÔ±¶¼ÖªµÀ£¬ÆäDTS¿ÉÒÔ½øÐÐÊý¾ÝµÄµ¼Èëµ¼³ö£¬Æäʵ£¬ÎÒÃÇÒ²¿ÉÒÔʹÓÃTransact-SQLÓï¾ä½øÐе¼Èëµ¼³ö²Ù×÷¡£ÔÚTransact-SQLÓï¾äÖУ¬ÎÒÃÇÖ÷ҪʹÓÃOpenDataSourceº¯Êý¡¢OPENROWSET º¯Êý£¬¹ØÓÚº¯ÊýµÄÏêϸ˵Ã÷£¬Çë²Î¿¼SQLÁª»ú°ïÖú¡£ÀûÓÃÏÂÊö·½·¨£¬¿ÉÒÔÊ®·ÖÈÝÒ×µØʵÏÖSQL SERVER¡¢ACCESS¡¢EXCELÊý¾Ýת»»£¬Ïêϸ˵Ã÷ÈçÏ£º
Ò»¡¢SQL SERVER ºÍACCESSµÄÊý¾Ýµ¼Èëµ¼³ö
³£¹æµÄÊý¾Ýµ¼Èëµ¼³ö£º
ʹÓÃDTSÏòµ¼Ç¨ÒÆÄãµÄAccessÊý¾Ýµ½SQL Server£¬Äã¿ÉÒÔʹÓÃÕâЩ²½Öè:
¡¡¡¡¡ð1ÔÚSQL SERVERÆóÒµ¹ÜÀíÆ÷ÖеÄTools£¨¹¤¾ß£©²Ëµ¥ÉÏ£¬Ñ¡ÔñData Transformation
¡¡¡¡¡ð2Services£¨Êý¾Ýת»»·þÎñ£©£¬È»ºóÑ¡Ôñ czdImport Data£¨µ¼ÈëÊý¾Ý£©¡£
¡¡¡¡¡ð3ÔÚChoose a Data Source£¨Ñ¡ÔñÊý¾ÝÔ´£©¶Ô»°¿òÖÐÑ¡ÔñMicrosoft Access as the Source£¬È»ºó¼üÈëÄãµÄ.mdbÊý¾Ý¿â(.mdbÎļþÀ©Õ¹Ãû)µÄÎļþÃû»òͨ¹ýä¯ÀÀÑ°ÕÒ¸ÃÎļþ¡£
¡¡¡¡¡ð4ÔÚChoose a Destination£¨Ñ¡ÔñÄ¿±ê£©¶Ô»°¿òÖУ¬Ñ¡ÔñMicrosoft OLE¡¡DB Prov ider for SQL¡¡Server£¬Ñ¡ÔñÊý¾Ý¿â·þÎñÆ÷£¬È»ºóµ¥»÷±ØÒªµÄÑéÖ¤·½Ê½¡£
¡¡¡¡¡ð5ÔÚSpecify Table Copy£¨Ö¸¶¨±í¸ñ¸´ÖÆ£©»òQuery£¨²éѯ£©¶Ô»°¿òÖУ¬µ¥»÷Copy tables£¨¸´ÖƱí¸ñ£©¡£
¡ð6ÔÚSelect Source Tables£¨Ñ¡ÔñÔ´±í¸ñ£©¶Ô»°¿òÖУ¬µ¥»÷Select All£¨È«²¿Ñ¡¶¨£©¡£ÏÂÒ»²½£¬Íê³É¡£
Transact-SQLÓï¾ä½øÐе¼Èëµ¼³ö£º
1.ÔÚSQL SERVERÀï²éѯaccessÊý¾Ý:
SELECT *
from OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\DB.mdb";User ID=Admin;Password=')...±íÃû
2.½«accessµ¼ÈëSQL server
ÔÚSQL SERVER ÀïÔËÐÐ:
SELECT *
INTO newtable
from OPENDATASOURCE ('Microsoft.Jet.OLEDB.4.0',
'Data Source="c:\DB.mdb";User ID=Admin;Password=' )...±íÃû
3.½«SQL SERVER±íÀïµÄÊý¾Ý²åÈëµ½Access±íÖÐ
ÔÚSQL SERVER ÀïÔËÐУº
insert into OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source=" c:\DB.mdb";User ID=Admin;Password=')...±íÃû
(ÁÐÃû1,ÁÐÃû2)
select ÁÐÃû1,ÁÐÃû2 from sql±í
ʵÀý£º
insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0',
'C:\db.mdb';'admin';'', Test)
select id,name from Test
INSERT INTO OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'c:\trade.mdb'; 'admin'; '', ±íÃû)
SELECT *
from
Ïà¹ØÎĵµ£º
°²×°Íê±ÏÖ®ºó£¬»¹ÐèÒªÉèÖÃһϲÅÄÜʹsql·þÎñÁ´½Ó³É¹¦¡£ Ñ¡ÔñµÚÒ»¸ö£º·þÎñºÍÁ´½ÓµÄÍâΧӦÓÃÅäÖÃÆ÷ µã»÷¡°Ô¶³ÌÁ´½Ó¡±£¬ÔÙÑ¡Ôñ±¾µØÁ´½ÓºÍÔ¶³ÌÁ´½Ó¡£Ñ¡ÔñµÚ3¸öÑ¡Ïî¡£ ºÃÁË¡£ÎÒÃÇ¿ÉÒÔµ½¿ªstudioÁË¡£ ¼ÇµÃÔÚ·þÎñÆ÷Ãû³ÆÊäÈ룺localhost\SQLEXPRESS
µÇ¼Ãûsa¡£ÃÜÂë¾ÍÊÇ°²×°µÄʱºòÊäÈëµÄÃÜÂë¡£ ok¡£¡£¡£ºÃÁË¡£¡£¡£¡ ......
ID int identity(1,1) primary key ×Ô¶¯Ôö³¤,Ö÷¼ü
EXEC sp_rename 'login_info','PDI_login_info' Ö´Ðд洢¹ý³Ì sp_rename , ½«login_info±íÃû ¸ü¸ÄΪ PDI_login_info
SET XACT_ABORT {ON|OFF} Èç¹ûÊÂÎñÖз¢Éú´íÎó£¬on Ôò»áÖÕÖ¹Õû¸öÊÂÎñµÄÖ´ÐУ¬Èç¹ûOFF£¬¼ÌÐø´íÎóµÄÏÂÃæÒ»¾ä
SET &nbs ......
ÏÂÁÐÓï¾ä²¿·ÖÊÇMssql
Óï¾ä£¬²»¿ÉÒÔÔÚaccess
ÖÐʹÓá£
SQL
·ÖÀࣺ
DDL—
Êý¾Ý¶¨ÒåÓïÑÔ(CREATE
£¬ALTER
£¬DROP
£¬DECLARE)
DML—
Êý¾Ý²Ù×ÝÓïÑÔ(SELECT
£¬DELETE
£¬UPDATE
£¬INSERT)
DCL—
Êý¾Ý¿ØÖÆÓïÑÔ(GRANT
£¬REVOKE
£¬COMMIT
£¬ROLLBACK)
Ê×ÏÈ,
¼òÒª½éÉÜ»ù´¡Óï¾ä£º
1
¡¢ËµÃ÷£º ......
Sql´úÂë
--²ÉÓÃSQLÓï¾äʵÏÖsql2005ºÍExcel Êý¾ÝÖ®¼äµÄÊý¾Ýµ¼Èëµ¼³ö£¬ÔÚÍøÉÏÕÒÀ´Ò»--Ï£¬ÊµÏÖ·½·¨ÊÇÕâÑùµÄ£º
--Excel---->SQL2005 µ¼È룺
select * into useinfo from O ......
Ò»¡¢SQL SERVER ºÍACCESSµÄÊý¾Ýµ¼Èëµ¼³ö
³£¹æµÄÊý¾Ýµ¼Èëµ¼³ö£º
ʹÓÃDTSÏòµ¼Ç¨ÒÆÄãµÄAccessÊý¾Ýµ½SQL Server£¬Äã¿ÉÒÔʹÓÃÕâЩ²½Öè:
¡¡¡¡¡ð1ÔÚSQL SERVERÆóÒµ¹ÜÀíÆ÷ÖеÄTools£¨¹¤¾ß£©²Ëµ¥ÉÏ£¬Ñ¡ÔñData Transformation
¡¡¡¡¡ð2Services£¨Êý¾Ýת»»·þÎñ£©£¬È»ºóÑ¡Ôñ czdImport Dat ......