Help with UDF using OPENROWSET to EXECUTE sproc
From: JJA (johna_at_cbmiweb.com)
Date: 12/30/04
- Next message: MisterB: "Converting a SQL Database to MSDE"
- Previous message: Geoff N. Hiten: "Re: Sub Query"
- Next in thread: Adam Machanic: "Re: Help with UDF using OPENROWSET to EXECUTE sproc"
- Reply: Adam Machanic: "Re: Help with UDF using OPENROWSET to EXECUTE sproc"
- Messages sorted by: [ date ] [ thread ]
Date: 30 Dec 2004 10:21:48 -0800
Here is the UDF I am trying to create:
ALTER FUNCTION dbo.TieredAccessCounties
(
@State CHAR(2)
, @SourceTable CHAR(1)
, @UserName VARCHAR(30)
)
RETURNS TABLE
AS
RETURN
SELECT A.* FROM
OPENROWSET('SQLOLEDB','MDWDATA';'sa';'passwordX',
'EXECUTE dbo.AccountFetchCounties NULL, @SourceTable, @UserName ')
AS A
I cannot get this to work. I am getting these messages:
Server: Msg 8180, Level 16, State 1, Procedure TieredAccessCounties,
Line 10
Statement(s) could not be prepared.
Server: Msg 137, Level 15, State 1, Procedure TieredAccessCounties,
Line 10
Must declare the variable '@SourceTable'.
[OLE/DB provider returned message: Deferred prepare could not be
completed.]
- Next message: MisterB: "Converting a SQL Database to MSDE"
- Previous message: Geoff N. Hiten: "Re: Sub Query"
- Next in thread: Adam Machanic: "Re: Help with UDF using OPENROWSET to EXECUTE sproc"
- Reply: Adam Machanic: "Re: Help with UDF using OPENROWSET to EXECUTE sproc"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|