Extracting data warehouses: execute stored procedure openrowset

Original: extracting data warehouses: execute stored procedure openrowset

 

In doing data warehousing, ETL is the most important development, and the first step in the ETL development, is extracted from the raw data to the OLTP system in the transition zone, and then the data in this transition zone conversion, final the load clean processed data into the data warehouse.

 

Target database is sql server, stored procedures invoked by openrowset function, but not with stored procedure parameters.

 

1, open ad hoc queries


   
   
  1. --修改高级参数
  2. sp_configure ' show advanced options ',1
  3. go
  4. --允许即席分布式查询
  5. sp_configure 'Ad Hoc Distributed Queries ',1
  6. go
  7. --如果配置的值不在合理范围(在最小值最大值范围内),那么可以强制覆盖
  8. reconfigure with override  
  9. go

2, call a stored procedure

The greatest advantage of this use, the results of the stored procedure can be executed select it, if written in front of the insert, can be inserted into the table, very convenient.

But the limitations are very clear, that is, stored procedures can not have parameters.

When using OPENROWSET function, attention parameter format, and the format of the characters between the parameters.


   
   
  1. SELECT *
  2. FROM OPENROWSET( 'SQLOLEDB',
  3. 'Server=PC0627JVC\MSSQLSERVER2008;Trusted_Connection=yes;database=master',
  4. 'exec sp_lock')
  5. SELECT *
  6. FROM OPENROWSET( 'SQLOLEDB',
  7. 'Server=PC0627JVC\MSSQLSERVER2008;uid=sa;pwd=xxx;',
  8. 'exec master.dbo.sp_lock')

 

Published 416 original articles · won praise 135 · views 940 000 +

Guess you like

Origin www.cnblogs.com/lonelyxmas/p/12019920.html