SQLServer 數(shù)據(jù)庫函數(shù)的概述
以下的文章主要向大家講述的是SQLServer 數(shù)據(jù)庫函數(shù),主要是OPENROWSET 與OPENDATASOURCE這兩種,這兩個(gè)函數(shù)不僅能實(shí)現(xiàn)從另外的數(shù)據(jù)庫讀數(shù)據(jù),同時(shí)還能從EXCEL、TXT, ORACLE, ODBC 等讀數(shù)據(jù)。
啟用Ad Hoc Distributed Queries:
- exec sp_configure ’show advanced options’,1
- reconfigure
- exec sp_configure ’Ad Hoc Distributed Queries’,1
- reconfigure
- SELECT *
- FROM OPENDATASOURCE(
- ’SQLOLEDB’,
- ’Data Source=SQLServerName;User ID=sa;Password=xxx’
- ).Help.dbo.Help_Category
或
- select * from openrowset( ’SQLOLEDB ’, ’SQLServerName’; ’sa’; ’xxx’, Help.dbo.Help_Category )
關(guān)閉Ad Hoc Distributed Queries:
- exec sp_configure ’Ad Hoc Distributed Queries’,0
- reconfigure
- exec sp_configure ’show advanced options’,0
- reconfigure
以上的相關(guān)內(nèi)容就是對SQLServer 數(shù)據(jù)庫函數(shù)的介紹,望你能有所收獲。
上述的相關(guān)內(nèi)容就是對SQLServer 數(shù)據(jù)庫函數(shù)的描述,希望會(huì)給你帶來一些幫助在此方面。
【編輯推薦】