DBF±íÓëSQL Server±íµÄµ¼Èë¡¢µ¼³ö
----------Dbf µ¼Èë Sql Server±í----------
ÒÔϾùÒÔSQL2000¡¢VFP6¼°ÒÔÉϵıíΪÀý
´úÂëµ¼È룺²éѯ·ÖÎöÆ÷ÖÐÖ´ÐÐÈçÏÂÓï¾ä(ÏÈÑ¡Ôñ¶ÔÓ¦µÄÊý¾Ý¿â)
-------------Èç¹û½ÓÊܵ¼ÈëÊý¾ÝµÄSQL±íÒÑ´æÔÚ
--Èç¹û½ÓÊܵ¼ÈëÊý¾ÝµÄSQL±íÒѾ´æÔÚ
Insert Into ÒѾ´æÔÚµÄSQL±íÃû Select * from openrowset('MSDASQL','Driver=Microsoft Visual FoxPro Driver;SourceType=DBF;SourceDB=c:','select * from aa.DBF')
--Ò²¿ÉÒÔ¶ÔÓ¦ÁÐÃû½øÐе¼È룬È磺
Insert Into ÒѾ´æÔÚµÄSQL±íÃû (ÁÐÃû1,ÁÐÃû2...) Select (¶ÔÓ¦ÁÐÃû1,¶ÔÓ¦ÁÐÃû2...) from openrowset('MSDASQL','Driver=Microsoft Visual FoxPro Driver;SourceType=DBF;SourceDB=c:','select * from aa.DBF')
-------------Èç¹û½ÓÊܵ¼ÈëÊý¾ÝµÄSQL±í²»´æÔÚ£¬µ¼Èëʱ´´½¨
--·½·¨Ò»£ºÓÐÒ»¸öȱµã£º°ÑDBF±íµ¼ÈëSQL ServerÖкó£¬ÂíÉÏÓÃVISUAL FOXPRO´ò¿ªDBF±í£¬»áÌáʾ“²»ÄÜ´æÈ¡Îļþ”£¬¼´Õâ¸ö±í»¹±»SQL´ò¿ª×ÅÄØ¡£¿ÉÊǹýÁË1·ÖÖÓ×óÓÒ£¬ÔÙ´ò¿ªDBF±í¾Í¿ÉÒÔÁË£¬ËµÃ÷¾¹ýÒ»¶Îʱ¼äºó²éѯ·ÖÎöÆ÷²Å°ÑÕâ¸ö±í¹Ø±Õ¡£
Select * Into ÒªÉú³ÉµÄSQL±íÃû from openrowset('MSDASQL','Driver=Microsoft Visual FoxPro Driver;SourceType=DBF;SourceDB=c:','select * from dbf±íÃû.DBF')
--·½·¨¶þ£ºÓÐÒ»¸öȱµã£º°ÑDBF±íµ¼ÈëSQL ServerÖкó£¬ÂíÉÏÓÃVISUAL FOXPRO´ò¿ªDBF±í£¬»áÌáʾ“²»ÄÜ´æÈ¡Îļþ”£¬¼´Õâ¸ö±í»¹±»SQL´ò¿ª×ÅÄØ¡£¿ÉÊǹýÁË1·ÖÖÓ×óÓÒ£¬ÔÙ´ò¿ªDBF±í¾Í¿ÉÒÔÁË£¬ËµÃ÷¾¹ýÒ»¶Îʱ¼äºó²éѯ·ÖÎöÆ÷²Å°ÑÕâ¸ö±í¹Ø±Õ¡£
Select * Into TEMP1 from openrowset('VFPOLEDB.1','C:';'admin';'' ,'select * from dbf±íÃû.DBF')
--Èç¹ûûÓа²×°VFP£¬ÐèÒª°Ñvfpoledb.dll¿½±´µ½SYSTEMĿ¼Ï£¬²¢×¢²á¡£
--·½·¨Èý£ºµ¼ÈëSQL SERVERºó£¬Ô´±íÔÙÓÃVFP´ò¿ª¾Í²»Ìáʾ“²»ÄÜ´æÈ¡Îļþ”£¬ËµÃ÷Óï¾äÖ´Ðкó¾Í°ÑÔ´±í¹Ø±ÕÁË¡£²»¹ýÒ²Óв»¾¡ÈËÒâµÄµØ·½£¬¾ÍÊÇÓÃÇ°Á½ÖÖ·½Ê½µ¼Èëºó£¬Ô´±íÖеÄ×Ö·ûÐÍ×ֶε¼ÈëºóSQL±í×ֶζÔÓ¦±ä³ÉNVARCHARÁË¡£
Select * Into ÒªÉú³ÉµÄSQL±íÃû from OPENROWSET('MICROSOFT.JET.OLEDB.4.0','dBase IV;HDR=NO;IMEX=2;DATABASE=c:','select * from dbf±íÃû.dbf')
--·½·¨ËÄ£ºµ¼ÈëSQL SERVERºó£¬Ô´±íÔÙÓÃVFP´ò¿ª¾Í²»Ìáʾ“²»ÄÜ´æÈ¡Îļþ”£¬ËµÃ÷Óï¾äÖ´Ðкó¾Í°ÑÔ´±í¹Ø±ÕÁË¡£²»¹ýÒ²Óв»¾¡ÈËÒâµÄµØ·½£¬¾ÍÊÇÓÃÇ°Á½ÖÖ·½Ê½µ¼Èëºó£¬Ô´±íÖеÄ×Ö·ûÐÍ×ֶε¼ÈëºóSQL±í×ֶζÔÓ¦±ä³ÉNVARCHARÁË¡£
Ïà¹ØÎĵµ£º
select pcode from (
select h.k,h.d,h.m,h.u,l.areacode,
l.areacode||substr(h.u,4,length(h.u))||h.k pcode
from(
&nb ......
inner join(µÈÖµÁ¬½Ó) Ö»·µ»ØÁ½¸ö±íÖÐÁª½á×Ö¶ÎÏàµÈµÄÐÐ
left join(×óÁª½Ó) ·µ»Ø°üÀ¨×ó±íÖеÄËùÓмǼºÍÓÒ±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
right join(ÓÒÁª½Ó) ·µ»Ø°üÀ¨ÓÒ±íÖеÄËùÓмǼºÍ×ó±íÖÐÁª½á×Ö¶ÎÏàµÈµÄ¼Ç¼
INNER JOIN Óï·¨£º
INNER JOIN Á¬½ÓÁ½¸öÊý¾Ý±íµÄÓ÷¨£º
SELECT * from ±í1 INNER JOIN ±í2 ON ±í1.×ֶκÅ=±í2 ......
±¾ÎÄÀ´×Ô£ºhttp://zhidao.baidu.com/question/27978123.html?si=1
ÕâЩÊÇ SQL-92 ÉèÖÃÓï¾ä£¬Ê¹ SQL Server 2000/2005 ×ñ´Ó SQL-92 ¹æÔò¡£
µ± SET QUOTED_IDENTIFIER Ϊ ON ʱ£¬±êʶ·û¿ÉÒÔÓÉË«ÒýºÅ·Ö¸ô£¬¶øÎÄ×Ö±ØÐëÓɵ¥ÒýºÅ·Ö¸ô¡£µ± SET QUOTED_IDENTIFIER Ϊ OFF ʱ£¬±êʶ·û²»¿É¼ÓÒýºÅ£¬ÇÒ±ØÐë·ûºÏËùÓÐ Transact-SQL ±êÊ ......
Êý¾ÝÀàÐÍ:
Ò»¡¢ ÕûÊýÊý¾ÝÀàÐÍ
INT(INTEGER) 4
SMALLINT 2
TINYINT 1
BIGINT & ......