YES we can..... :)
1. Creating a Stored Procedure:
If Object_Id('Proc1') Is Not Null
Drop Proc Proc1
Go
Create Proc Proc1
As
Begin
Select 'SQL Server'
End
Go2. Creating a Function:
If Object_Id('Function1') Is Not Null
Drop Function Function1
Go
Create Function dbo.Function1() Returns @Result Table
(
Result Varchar(100)
)
As
Begin
Insert @Result
SELECT * from OPENROWSET('SQLNCLI10', 'Server=<SERVERNAME>;UID=<LOGIN>;Pwd=<PASSWORD>;',
'Exec dbo.Proc1') AS C
Return
end
Go3. Executing the Function:
Select * from dbo.Function1()
Go
4. Result
Result
----------
SQL Server
- I have created one Stored procedure ("Proc1")
- I have created one Function. Calling the Stored procedure inside the Function using OPENROWSET :)
- I use the function to execute/call the stored procedure...
Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions
Sekar.C, if this helps please login to Mark As Answer. | Alert Moderator