存储过程与SQL的结合使用

时间:2024-01-07 10:00:38

--1调用存储过程
exec 存储过程名 参数

openrowset方法使用:

select * from openrowset('sqlncli', 'server=192.168.247.64;uid=sa;pwd=123;', 'exec dbo.process ''参数值''') as tmp;

-------------------------------------------------------------------------------------------------------------------------

a、启用Ad Hoc Distributed Queries:

exec sp_configure 'show advanced options',1
reconfigure
exec sp_configure 'Ad Hoc Distributed Queries',1
reconfigure

b、关闭Ad Hoc Distributed Queries:

exec sp_configure 'Ad Hoc Distributed Queries',0
reconfigure
exec sp_configure 'show advanced options',0
reconfigure