I have a stored proc called "dbo.SetSettlment" and a used defined
function called "dbo.GetSIFByType". The function works great, and so
does the sp. Problem is, I can't get them to work together.
See below, I have three statement. The first two work fine, the last
doesn't. How can I get around this?
EXECUTE dbo.SetSettlment @.SettlementAmt = 66
go
SELECT dbo.GetSIFByType(1)
go
EXECUTE dbo.SetSettlment @.SettlementAmt = dbo.GetSIFByType(1)
Thanks!
Jason RoozeeYou can't pass a function as a parameter.
Try
DECLARE @.sAmount INT
SELECT @.sAmount = dbo.GetSIFByType(1)
EXEC dbo.SetSettlement @.settlementAmt = @.sAmount
<jroozee@.gmail.com> wrote in message
news:1127408994.622820.135290@.g49g2000cwa.googlegroups.com...
>I have a stored proc called "dbo.SetSettlment" and a used defined
> function called "dbo.GetSIFByType". The function works great, and so
> does the sp. Problem is, I can't get them to work together.
> See below, I have three statement. The first two work fine, the last
> doesn't. How can I get around this?
>
> EXECUTE dbo.SetSettlment @.SettlementAmt = 66
> go
> SELECT dbo.GetSIFByType(1)
> go
> EXECUTE dbo.SetSettlment @.SettlementAmt = dbo.GetSIFByType(1)
> Thanks!
> Jason Roozee
>|||try this
declare @.intType
select @.intType = dbo.GetSIFByType(1)
EXECUTE dbo.SetSettlment @.SettlementAmt = @.intType
or
EXECUTE dbo.SetSettlment @.intType
http://sqlservercode.blogspot.com/
"jroozee@.gmail.com" wrote:
> I have a stored proc called "dbo.SetSettlment" and a used defined
> function called "dbo.GetSIFByType". The function works great, and so
> does the sp. Problem is, I can't get them to work together.
> See below, I have three statement. The first two work fine, the last
> doesn't. How can I get around this?
>
> EXECUTE dbo.SetSettlment @.SettlementAmt = 66
> go
> SELECT dbo.GetSIFByType(1)
> go
> EXECUTE dbo.SetSettlment @.SettlementAmt = dbo.GetSIFByType(1)
> Thanks!
> Jason Roozee
>|||I would but I am using ADO 2.7 - it doesn't like it when I declare a
var like that.
Jason Roozee|||Jason,
Try making 2 seperate calls in ADO.
First, call the function and return the value in a recordset. Then grab the
value from the recordset and cal the stored proc.
Yosh
<jroozee@.gmail.com> wrote in message
news:1127409622.711723.133570@.o13g2000cwo.googlegroups.com...
>I would but I am using ADO 2.7 - it doesn't like it when I declare a
> var like that.
> Jason Roozee
>|||Of course I could do that - but that's exactly what I am trying to
avoid doing.
Jason|||Looks like your gonna have to.
<jroozee@.gmail.com> wrote in message
news:1127410712.970994.235920@.o13g2000cwo.googlegroups.com...
> Of course I could do that - but that's exactly what I am trying to
> avoid doing.
> Jason
>|||> Of course I could do that - but that's exactly what I am trying to
> avoid doing.
Why? The way you've set it up (a stored procedure that uses the result of a
function), you're pretty much guaranteeing that you need to make two calls.
Why don't you consider passing 1 into the stored procedure, and letting IT
call the function locally.
A|||you could change the proc to take the function's parameter instead and
have the proc call the function...
exec dbo.SetSettlement 1
jroozee@.gmail.com wrote:
>I have a stored proc called "dbo.SetSettlment" and a used defined
>function called "dbo.GetSIFByType". The function works great, and so
>does the sp. Problem is, I can't get them to work together.
>See below, I have three statement. The first two work fine, the last
>doesn't. How can I get around this?
>
>EXECUTE dbo.SetSettlment @.SettlementAmt = 66
>go
>SELECT dbo.GetSIFByType(1)
>go
>EXECUTE dbo.SetSettlment @.SettlementAmt = dbo.GetSIFByType(1)
>Thanks!
>Jason Roozee
>
>
Tuesday, March 27, 2012
EXEC SP w/Function
Labels:
database,
dbo,
definedfunction,
exec,
function,
getsifbytype,
microsoft,
mysql,
oracle,
proc,
server,
setsettlment,
sodoes,
sql,
stored
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment