SQL ServerµÄÁ´½Ó·þÎñÆ÷¼¼ÊõС½á
Ò»¡¢Ê¹Óà Microsoft OLE DB Provider For ODBC Á´½ÓMySQL
°²×°MySQLµÄODBCÇý¶¯MyODBC
1¡¢ÎªMySQL½¨Á¢Ò»¸öODBCϵͳÊý¾ÝÔ´£¬ÀýÈ磺ѡÔñÊý¾Ý¿âΪtest ,Êý¾ÝÔ´Ãû³ÆΪ
myDSN
2¡¢½¨Á¢Á´½ÓÊý¾Ý¿â
EXEC sp_addlinkedserver @server = 'MySQLTest', @srvproduct='MySQL',
@provider = 'MSDASQL', @datasrc = 'myDSN'
GO
EXEC sp_addlinkedsrvlogin
@rmtsrvname='MySqlTest',@useself='false',@locallogin='sa',@rmtuser='mys
qlµÄÓû§Ãû',@rmtpassword='mysqlµÄÃÜÂë'
3¡¢²éѯÊý¾Ý
SELECT * from OPENQUERY (MySQLTest ,'select * from ±í' )
ÏÂÃæÕâ¸ö²»ÐУº
SELECT * from OPENQUERY (MySQLTest ,'±í' )
×¢Ò⣺²»ÄÜÖ±½ÓÓÃselect * from Á´½Ó·þÎñÆ÷Ãû.Êý¾Ý¿âÃû.Óû§Ãû.±í(»òÊÓͼ)
ËIJ¿·ÖÃû³Æ²éѯÊý¾Ý£¬¿ÉÄÜÊǸöBug.
¶þ¡¢Ê¹Óà Microsoft OLE DB Provider For ORACLE Á´½ÓORACLE
1¡¢½¨Á¢Á´½ÓÊý¾Ý¿â
sp_addlinkedserver '±ðÃû', 'Oracle', 'MSDAORA', '·þÎñÃû'
GO
EXEC sp_addlinkedsrvlogin @rmtsrvname='±ðÃû
',@useself='false',@locallogin='sa',@rmtuser='oracle̞
',@rmtpassword='ÃÜÂë'
2¡¢²éѯÊý¾Ý
SELECT * from ±ðÃû..Óû§Ãû.±í(ÊÓͼ)
×¢Ò⣺ËIJ¿·ÖÃû³ÆÈ«²¿Óôóд
3¡¢Ö´Ðд洢¹ý³Ì
ʹÓÃOPENQUERY:
SELECT *
from OPENQUERY(±ðÃû, 'exec Óû§Ãû.´æ´¢¹ý³ÌÃû')
Èý¡¢ÉèÖÃÁ´½Ó·þÎñÆ÷ÒÔ·ÃÎʸñʽ»¯Îı¾Îļþ
ÓÃÓÚ Jet µÄ Microsoft OLE DB Ìṩ³ÌÐò¿ÉÓÃÓÚ·ÃÎʲ¢²éѯÎı¾Îļþ¡£
ÈôÒªÖ±½Ó´´½¨·ÃÎÊÎı¾ÎļþµÄÁ´½Ó·þÎñÆ÷¶ø²»½«ÎļþÁ´½ÓΪ Access .mdb ÎļþÖÐ
µÄ±í£¬ÇëÖ´ÐÐ sp_addlinkedserver£¬ÈçÏÂÀýËùʾ¡£
Ìṩ³ÌÐòÊÇ Microsoft.Jet.OLEDB.4.0£¬Ìṩ³ÌÐò×Ö·û´®Îª"Text"¡£Êý¾ÝÔ´ÊÇ°ü
º¬Îı¾ÎļþµÄĿ¼µÄÍêÕû·¾¶Ãû³Æ¡£schema.ini Îļþ£¨ÃèÊöÎı¾ÎļþµÄ½á¹¹£©±Ø
ÐëÓë´ËÎı¾Îļþ´æÔÚÓÚÏàͬµÄĿ¼ÖС£Óйش´½¨ schema.ini ÎļþµÄ¸ü¶àÐÅÏ¢£¬
Çë²Î¼û Jet Êý¾Ý¿âÒýÇæÎĵµ¡£
--Create a linked server.
EXEC sp_addlinkedserver txtsrv, 'Jet 4.0',
'Microsoft.Jet.OLEDB.4.0',
'c:\data\distqry',
NULL,
'Text'
GO
--Set up login mappings.
EXEC sp_addlinkedsrvlogin txtsrv, FALSE, NULL, Admin, NULL
GO
--List the tables in the linked server.
EXEC sp_tables_ex txtsrv
GO
--Query one of th
Ïà¹ØÎĵµ£º
ϵͳ»·¾³£ºWindows 7
Èí¼þ»·¾³£ºVisual C++ 2008 SP1 +SQL Server 2005
±¾´ÎÄ¿µÄ£º±àдһ¸öº½¿Õ¹ÜÀíϵͳ
ÕâÊÇÊý¾Ý¿â¿Î³ÌÉè¼ÆµÄ³É¹û£¬ËäÈ»³É¼¨²»¼Ñ£¬µ«ÊÇ×÷ΪÎÒÓÃVC++ ÒÔÀ´±àдµÄ×î´ó³ÌÐò»¹ÊÇ´«µ½ÍøÉÏ£¬ÒÔ¹©²Î¿¼¡£ÓÃVC++ ×öÊý¾Ý¿âÉè¼Æ²¢²»ÈÝÒ×£¬µ«Ò²²»ÊDz»¿ÉÄÜ¡£ÒÔÏÂÊÇÎҵijÌÐò½çÃ棬ºóÃæ ......
JavaÊý¾ÝÀàÐÍ
HibernateÊý¾ÝÀàÐÍ
±ê×¼SQLÊý¾ÝÀàÐÍ
byte
byte
TINYINT
short
short
SMALLINT
int
integer
INGEGER
long
long
BIGINT
float
float
FLOAT
double
double
DOUBLE
java.math.BigDecimal
big_decimal
NUMERIC
char, java.lang.Character
character
CHAR(1)
boolean, java.lang.Boole ......
1.¶¨Òå»ù±¾±íÓï¾ä
Óï·¨£º
USE Êý¾Ý¿âÃû CREATE TABLE ±íÃû (ÁÐÃû ÀàÐÍ(´óС) DEFAULT'ĬÈÏÖµ',
& ......
»¨ÁËÁ½¸öÍíÉÏ°ïÅóÓѽ«Ò»¸öasp¿ª·¢µÄÍøÕ¾´ÓACCESSÊý¾Ý¿âתÏòSQL SERVER 2000. ÍøÉϲéÁËЩ×ÊÁÏ£¬¼ÓÉÏ×Ô¼ºµÄ¾Àú£¬×ܽ᣺
1¡¢Ê×ÏÈ¿´asp µÄ³ÌÐòÖÐÊÇ·ñÓÐ on error resume next; Èç¹ûÓÐ,ÏÈ×¢Ê͵ô¡£·ñÔòºÜ¶à´íÎóÎÞ·¨±©Â¶³öÀ´
2¡¢´´½¨SQL SERVER Êý¾Ý±í¡£ ʹÓÃSQL SERVER 2000×Ô´øµÄÊý¾Ýµ¼ÈëÏòµ¼£¬½«ACCESSÊý¾Ý¿âÖеıí½á¹¹£¬ÒÔ¼ ......
--SQL ËÙ²éÊÖ²á
/*******************************************/
SELECT
--ÓÃ;£º´ÓÖ¸¶¨±íÖÐÈ¡³öÖ¸¶¨ÁеÄÊý¾Ý
--Óï·¨£º
SELECT column_name(s) from table_name
--Ö÷Òª×Ö¾ä¿ÉժҪΪ:
SELECT select_list [INTO new_table]
from table_source
[WHERE search_condition]
[GROUP BY group_by_expression]
[HAVING s ......