- create procedure JoinTable
- as
- begin
- SELECT a.column1 as cl1,a.column2 as cl2,b.column2 as cl3
- FROM table1 a inner join table2 b on a.column1=b.column1;
- end
- sp_configure 'show advanced options', 1;
- GO
- RECONFIGURE;
- GO
- sp_configure 'Ad Hoc Distributed Queries', 1;
- GO
- RECONFIGURE;
- GO
- select * from OPENROWSET
- ('SQLOLEDB','SERVER=v-xikan7;uid=sa;pwd=Yukon900;Database=cofeidb'
- ,'SET FMTONLY OFF;SET NOCOUNT ON exec JoinTable') as a
在SELECT后面使用存储过程返回表
最新推荐文章于 2024-07-03 03:23:45 发布