1.µ½http://www.oracle.com/technology/global/cn/software/tech/oci/instantclient/htdocs/winsoft.htmlÏÂÔØ
11.1.0.7.0 °æµÄ¼´Ê±¿Í»§¶Ë³ÌÐò°ü — Basic£¨²»ÊÇBasic Lite£©
2.½«ÏÂÔص½µÄÎļþ½âѹ£¬½âѹºóÎÒ½«Ä¿Â¼instantclient_11_1ÀïµÄÈ«²¿Îļþ¿½±´µ½ÁËÒ»¸öеÄĿ¼£ºE:\programs\OracleClient¡£ÄãÒ²¿ÉÒÔ²»¿½±´£¬Ö±½ÓʹÓýâѹºóµÄĿ¼Ãû¡£
3.´´½¨Îļþtnsnames.ora£¬ÄÚÈÝÈçÏ£º
APP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.22.6)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = app)
)
)
×¢£ºÐèÒª¸ü¸ÄµÄÊÇ£º1.°Ñ HOSTµÄÖµ172.22.22.6¸Ä³ÉÄãÒªÁ¬½ÓµÄÊý¾Ý¿âËùÔÚÖ÷»úµÄµØÖ·£»2.°ÑSERVICE_NAMEµÄÖµ¸Ä³ÉÄãҪʹÓõÄÔ¶³ÌÊý¾Ý¿âÃû
4.ÉèÖÃpl/sql DeveloperµÄperference¡£½«OracleµÄConnectionÀïµÄOracleÖ÷Ŀ¼ÉèÖÃΪÔÚµÚ2²½ÀïÉèÖõÄĿ¼£¬ÎÒµÄÊÇ£ºE:\programs\OracleClient£¬Í¬Ê±½«OCI¿âÉèÖÃΪE:\programs\OracleClient\oci.dll
5.ÉèÖû·¾³±äÁ¿¡ ......
1.µ½http://www.oracle.com/technology/global/cn/software/tech/oci/instantclient/htdocs/winsoft.htmlÏÂÔØ
11.1.0.7.0 °æµÄ¼´Ê±¿Í»§¶Ë³ÌÐò°ü — Basic£¨²»ÊÇBasic Lite£©
2.½«ÏÂÔص½µÄÎļþ½âѹ£¬½âѹºóÎÒ½«Ä¿Â¼instantclient_11_1ÀïµÄÈ«²¿Îļþ¿½±´µ½ÁËÒ»¸öеÄĿ¼£ºE:\programs\OracleClient¡£ÄãÒ²¿ÉÒÔ²»¿½±´£¬Ö±½ÓʹÓýâѹºóµÄĿ¼Ãû¡£
3.´´½¨Îļþtnsnames.ora£¬ÄÚÈÝÈçÏ£º
APP =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.22.22.6)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = app)
)
)
×¢£ºÐèÒª¸ü¸ÄµÄÊÇ£º1.°Ñ HOSTµÄÖµ172.22.22.6¸Ä³ÉÄãÒªÁ¬½ÓµÄÊý¾Ý¿âËùÔÚÖ÷»úµÄµØÖ·£»2.°ÑSERVICE_NAMEµÄÖµ¸Ä³ÉÄãҪʹÓõÄÔ¶³ÌÊý¾Ý¿âÃû
4.ÉèÖÃpl/sql DeveloperµÄperference¡£½«OracleµÄConnectionÀïµÄOracleÖ÷Ŀ¼ÉèÖÃΪÔÚµÚ2²½ÀïÉèÖõÄĿ¼£¬ÎÒµÄÊÇ£ºE:\programs\OracleClient£¬Í¬Ê±½«OCI¿âÉèÖÃΪE:\programs\OracleClient\oci.dll
5.ÉèÖû·¾³±äÁ¿¡ ......
/*=================== µ¼Èë/µ¼³ö Excel µÄ»ù±¾·½·¨ ===================*/
¡¡¡¡
¡¡¡¡´ÓExcelÎļþÖÐ,µ¼ÈëÊý¾Ýµ½SQLÊý¾Ý¿âÖÐ,ºÜ¼òµ¥,Ö±½ÓÓÃÏÂÃæµÄÓï¾ä:
¡¡¡¡
¡¡¡¡/*===================================================================*/
¡¡¡¡--Èç¹û½ÓÊÜÊý¾Ýµ¼ÈëµÄ±íÒѾ´æÔÚ
¡¡¡¡insert into ±í select * from
¡¡¡¡OPENROWSET('MICROSOFT.JET.OLEDB.4.0'
¡¡¡¡,'Excel 5.0;HDR=YES;DATABASE=c:test.xls',sheet1$)
¡¡¡¡
¡¡¡¡--Èç¹ûµ¼ÈëÊý¾Ý²¢Éú³É±í
¡¡¡¡select * into ±í from
¡¡¡¡OPENROWSET('MICROSOFT.JET.OLEDB.4.0'
¡¡¡¡,'Excel 5.0;HDR=YES;DATABASE=c:test.xls',sheet1$)
¡¡¡¡
¡¡¡¡
¡¡¡¡/*===================================================================*/
¡¡¡¡--Èç¹û´ÓSQLÊý¾Ý¿âÖÐ,µ¼³öÊý¾Ýµ½Excel,Èç¹ûExcelÎļþÒѾ´æÔÚ,¶øÇÒÒѾ°´ÕÕÒª½ÓÊÕµÄÊý¾Ý´´½¨ºÃ±íÍ·,¾Í¿ÉÒÔ¼òµ¥µÄÓÃ:
¡¡¡¡insert into OPENROWSET('MICROSOFT.JET.OLEDB.4.0'
¡¡¡¡,'Excel 5.0;HDR=YES;DATABASE=c:test.xls',sheet1$)
¡¡¡¡select * from ±í
¡¡¡¡
¡¡¡¡
¡¡¡¡--Èç¹ûExcelÎļþ²»´æÔÚ,Ò²¿ÉÒÔÓÃBCPÀ´µ¼³ÉÀàExcelµÄÎļþ,×¢Òâ´óСд:
¡¡¡¡--µ¼³ö±íµÄÇé¿ö
¡¡¡¡EXEC m ......
Òý:ÏÖÔÚһЩÖÐСÆóÒµ¶¼¹ã·ºÊ¹ÓÃMS Windows NT ΪÍøÂç²Ù×÷ϵͳƽ̨£¬SQL Server Ϊºǫ́Êý¾Ý¿â¹¹½¨ÆóÒµÄÚ²¿µÄ¸÷ÖÖ¹ÜÀíϵͳ£¬¸Ã³ÉÊì¼¼ÊõµÄÆÕ¼°£¬ÄÜÓÐЧµØ°ïÖúÆóÒµ¶ÔÄÚ²¿Êý¾Ý½øÐйÜÀí¡£ÕâÀàÓ¦ÓÃÖУ¬¶ÔÊý¾Ý¿âµÄ±¸·ÝÊǺÜÖØÒªµÄÒ»Ï×÷£¬ÆäÖØÒªÐÔ²»±Ø¶àÑÔ¡£
¡¡¡¡Æ䱸·ÝµÄ·½·¨ºÜ¶à£¬È磺ÔÚһЩ¹æÄ£½Ï´ó¡¢×ʽðÐÛºñµÄÆóÒµ£¬ÍùÍùÊDzÉÓÃË«»úÈßÓ౸·Ý»úÖÆ£¬¼´ÔÚͬһ¸öNTÓòʹÓÃÁ½Ì¨·þÎñÆ÷£¬Ò»¸öÊÇÖ÷Óò¿ØÖÆÆ÷£¬ÁíÒ»¸öÊDZ¸·ÝÓò¿ØÖÆÆ÷£¬Á½Ì¨·þÎñÆ÷É϶¼ÓÐSQL Server£¬ÔÚ³ÌÐòµÄÔËÐйý³ÌÖУ¬²»¶ÏµØ½«Ö÷Óò¿ØÖÆÆ÷ÖеÄSQLÊý¾Ý¿âÐÂÊý¾Ý¸üе½±¸·ÝÓò¿ØÖÆÆ÷µÄSQL Êý¾Ý¿âÖС£ÕâÖÖ·½°¸µÄȱµãÊÇ£¬É豸Ͷ×Ê°º¹ó£¬¶ÔÈËÔ±ÒªÇó½Ï¸ß£¬²»ÊʺÏСÐÍÆóÒµ£»SQLServer ϵͳ±¾ÉíÒ²ÌṩÁ˱¸·ÝÊֶΣ¬µ«Ê¹ÓÃÆðÀ´ºÜ²»·½±ã£¬²¢ÇÒ±¸·Ý»Ö¸´Ê±¼ä½Ï³¤£¬·ÇרҵÈËÔ±ºÜÄÑʹÓã»±¸·ÝÎÊÌâÍ»³ö£¬ÀûÓõÚÈý·½Èí¼þ½â¾öÕâ¸öÎÊÌâÊֶν϶࣬µ«ÓÉÓÚÈí¼þµÄͶ×Ê¡¢°²È«¡¢°æȨµÈµÈÖî¶àÎÊÌ⣬¶øÇÒ³£³£ÊÇÈí¼þÔ½¶à£¬¼æÈÝÐÔÔ½²î£¬³öÏÖµÄÎÊÌâÔ½¶à£¬ËùÒÔרҵÈËÊ¿¶¼½¨Ò飬ÔÚÌõ¼þÔÊÐíµÄÇé¿öϾ¡¿ÉÄܲ»²ÉÓÃÕâЩ·½·¨¡£
¡¡¡¡ÎÒÔÚ1998 Äê¾Í¿ªÊ¼Ê¹ÓÃSQL ServerÊý¾Ý¿â±àÖƹ«Ë¾µÄÓªÒµ¹ÜÀíÊý¾Ý¿âϵͳ£¬¸ù¾ÝÎÒ¹«Ë¾µÄ¾ßÌåÇé¿ö²ÉÓÃÒ»Ì×¼ò½àʵÓõı¸·ÝÌåÖÆ£¬Ð§¹û±È ......
ÎÒÃÇÔÚÊý¾Ý¿âÖÐʹÓñíµÄʱºò,¾³£»áÓöµ½Á½ÖÖʹÓñíµÄ·½·¨,·Ö±ð¾ÍÊÇʹÓÃÁÙʱ±í¼°±í±äÁ¿¡£ÔÚʵ¼ÊʹÓõÄʱºò£¬ÎÒÃÇÈçºÎÁé»îµÄÔÚ´æ´¢¹ý³ÌÖÐÔËÓÃËüÃÇ£¬ËäÈ»ËüÃÇʵÏֵŦÄÜ»ù±¾ÉÏÊÇÒ»ÑùµÄ£¬¿ÉÈçºÎÔÚÒ»¸ö´æ´¢¹ý³ÌÖÐÓÐʱºòȥʹÓÃÁÙʱ±í¶ø²»Ê¹Óñí±äÁ¿£¬ÓÐʱºòȥʹÓñí±äÁ¿¶ø²»Ê¹ÓÃÁÙʱ±íÄØ?
¡¡¡¡ÁÙʱ±í
¡¡¡¡ÁÙʱ±íÓëÓÀ¾Ã±íÏàËÆ£¬Ö»ÊÇËüµÄ´´½¨ÊÇÔÚTempdbÖУ¬ËüÖ»ÓÐÔÚÒ»¸öÊý¾Ý¿âÁ¬½Ó½áÊøºó»òÕßÓÉSQLÃüÁîDROPµô£¬²Å»áÏûʧ£¬·ñÔò¾Í»áÒ»Ö±´æÔÚ¡£ÁÙʱ±íÔÚ´´½¨µÄʱºò¶¼»á²úÉúSQL ServerµÄϵͳÈÕÖ¾£¬ËäËüÃÇÔÚTempdbÖÐÌåÏÖ£¬ÊÇ·ÖÅäÔÚÄÚ´æÖеģ¬ËüÃÇÒ²Ö§³ÖÎïÀíµÄ´ÅÅÌ£¬µ«Óû§ÔÚÖ¸¶¨µÄ´ÅÅÌÀï¿´²»µ½Îļþ¡£
¡¡¡¡ÁÙʱ±í·ÖΪ±¾µØºÍÈ«¾ÖÁ½ÖÖ£¬±¾µØÁÙʱ±íµÄÃû³Æ¶¼ÊÇÒÔ“#”Ϊǰ׺£¬Ö»ÓÐÔÚ±¾µØµ±Ç°µÄÓû§Á¬½ÓÖвÅÊǿɼûµÄ£¬µ±Óû§´ÓʵÀý¶Ï¿ªÁ¬½Óʱ±»É¾³ý¡£È«¾ÖÁÙʱ±íµÄÃû³Æ¶¼ÊÇÒÔ“##”Ϊǰ׺£¬´´½¨ºó¶ÔÈκÎÓû§¶¼ÊǿɼûµÄ£¬µ±ËùÓÐÒýÓøñíµÄÓû§¶Ï¿ªÁ¬½Óʱ±»É¾³ý¡£
¡¡¡¡ÏÂÃæÎÒÃÇÀ´¿´Ò»¸ö´´½¨ÁÙʱ±íµÄÀý×Ó£º¡¡¡¡
CREATE TABLE dbo.#News
¡¡¡¡(
¡¡¡¡News_id int NOT NULL,
¡¡¡¡NewsTitle varchar(100),
¡¡¡¡NewsContent v ......
--1.ÔÚÄ¿±ê·þÎñÆ÷ÉϽ¨Á¢Èç϶ÔÏó(±»Í¬²½µÄ·þÎñÆ÷)
if exists (select * from dbo.sysobjects where id = object_id(N'[sys_syscomments_bak]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [sys_syscomments_bak]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[p_process_object]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[p_process_object]
GO
--´´½¨¸¨Öú´¦ÀíµÄ±í
create table sys_syscomments_bak(name sysname,xtype char(2),number smallint,colid smallint,status smallint,ctext varbinary(8000) ......
ÈçºÎÓÃÃüÁîÉú³ÉSQL SERVER½Å±¾
--ÒÔÏÂÉú³ÉÕû¸öÊý¾Ý¿âµÄSQL½Å±¾£¬ÎÒ²âÊÔÁË£¬Ï൱ºÃÓá£
--(scptxfr.exeµÄ·¾¶ÒªÕýÈ·ÒÔÏÂÊÇÎҵķ¾¶)
declare @cMd varchar(1000)
set @cmd = 'master.dbo.xp_cmdshell ' +
'''c:\"Microsoft ' +
'SQL Server"' +
'\MSSQL\Upgrade\scptxfr.exe ' +
' /s YourServerName /p YourSAPassword /I /d YourDBName /f ' +
'c:\YourDBName.sql'''
exec (@cmd)
ÃüÁîÐÐÓï·¨:
SCPTXFR /s <·þÎñÆ÷> /d <Êý¾Ý¿â> {[/I] | [/P <ÃÜÂë>]}
{[/F <½Å±¾ÎļþĿ¼>] | [/f <µ¥¸ö½Å±¾Îļþ>]} & ......