Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
heze
Posting Yak Master
192 Posts |
Posted - 2006-04-06 : 14:57:14
|
| hi Im doing:---declare @par as integerthen select * from DB.dbo.MyUserdefFunction(@par+1)---the error message is:Server: Msg 170, Level 15, State 1, Line 5Line 5: Incorrect syntax near '+'.---how can I pass a calculated parameter to my functionwhen I just pass @par there is no problemthank you |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2006-04-06 : 15:02:24
|
set @par = @par+1select * from DB.dbo.MyUserdefFunction(@par)--or declare @par1 integerset @par1 = @par+1select * from DB.dbo.MyUserdefFunction(@par1)Go with the flow & have fun! Else fight the flow Blog thingie: [URL="http://weblogs.sqlteam.com/mladenp"] |
 |
|
|
heze
Posting Yak Master
192 Posts |
Posted - 2006-04-06 : 15:06:57
|
| thanks s1,the problem though is that I would have to do the same for evey call, in case I wanted to send 5 different pars I would have to declare 5 different parameters statically.Myabe I could use a while cycle and dynamic sql to join the retunred values which by the ways are tables, but that makes things a little bit more cumbersome.thanks |
 |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-04-06 : 16:45:36
|
| heze,Why don't u do ur calculation inside each stored procedure?Or why don't u keep another procedure or function to return the calculated value and use it as a parameterSrinika |
 |
|
|
heze
Posting Yak Master
192 Posts |
Posted - 2006-04-06 : 17:08:59
|
| Yes Srin, I will do that, then I send 2 parameters as the operandsd of the additionthanks |
 |
|
|
|
|
|