------------------------------------
-- 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, 'database methods', 'wang ', 'gaojiao', 2006.9 union all
Select 2, 'information system', 'Liu ', 'kexue', 2006.8 union all
Select 3, 'database instance', 'wang ', 'gaojiao', 2006.9 union all
Select 4, 'database exercise ', '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
Select *
From OPENROWSET ('sqloledb', '.'; 'sa '; '', 'exec csdn_test.dbo.proc_a 2') AS
Select *
From OPENROWSET ('sqloledb', 'driver = {SQL Server}; SERVER =.; UID = sa; PWD = ', 'exec csdn_test.dbo.proc_a 2') AS
-- Drop proc
Drop proc proc_a
-- Result:
/*
Bno bname editor bpub bdate
--------------------------------------------------------------------------------------------
1. Database principle: wang gaojiao 2006.9
2. Information System liu kexue 2006.8
(The number of affected rows is 2)
Bno bname editor bpub bdate
--------------------------------------------------------------------------------------------
1. Database principle: wang gaojiao 2006.9
2. Information System liu kexue 2006.8
(The number of affected rows is 2)
Bno bname editor bpub bdate
--------------------------------------------------------------------------------------------
1. Database principle: wang gaojiao 2006.9
2. Information System liu kexue 2006.8
(The number of affected rows is 2)
*/
-- END
This article from the CSDN blog, reproduced please indicate the source: http://blog.csdn.net/happyflystone/archive/2008/08/01/2752936.aspx