------------------------------------
-- Author:Flystone
-- Version:V1.001
-- Date:2008-08-01 12:39:33
------------------------------------
-- Test Data: ta
If object_id('ta') is not null
Drop table ta
Go
Create table ta(bno int,bname nvarchar(5),editor nvarchar(5),bpub nvarchar(7),bdate numeric(5,1))
Go
Insert into ta
select 1,'数据库原理','wang','gaojiao',2006.9 union all
select 2,'信息系统','liu','kexue',2006.8 union all
select 3,'数据库实例','wang','gaojiao',2006.9 union all
select 4,'数据库习题','zhang','jixie',2005.4
Go
--create proc
create proc proc_a
@bno int
as
select * from ta where bno <= @bno
go
--Start
select *
from OPENROWSET('SQLOLEDB','SERVER=.;UID=sa;PWD=','exec csdn_test.dbo.proc_a 2') AS a
select *
from OPENROWSET('SQLOLEDB','.';'sa';'','exec csdn_test.dbo.proc_a 2') AS a
select *
from OPENROWSET('SQLOLEDB','DRIVER={SQL Server};SERVER=.;UID=sa;PWD=','exec csdn_test.dbo.proc_a 2') AS a
--Drop proc
drop proc proc_a
--Result:
/*
bno bname editor bpub bdate
----------- -------------------------------------------------- ------------ ------------ -------
1 数据库原理 wang gaojiao 2006.9
2 信息系统 liu kexue 2006.8
(所影响的行数为 2 行)
bno bname editor bpub bdate
----------- -------------------------------------------------- ------------ ------------ -------
1 数据库原理 wang gaojiao 2006.9
2 信息系统 liu kexue 2006.8
(所影响的行数为 2 行)
bno bname editor bpub bdate
----------- -------------------------------------------------- ------------ ------------ -------
1 数据库原理 wang gaojiao 2006.9
2 信息系统 liu kexue 2006.8
(所影响的行数为 2 行)
*/
--END
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/happyflystone/archive/2008/08/01/2752936.aspx