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 |
|
cokebaby666
Starting Member
7 Posts |
Posted - 2005-03-09 : 06:22:51
|
| Hi, I'm trying to figure out what I'm doing wrong with my function. To date, I can write a function that takes input parameters which are used to filter data (to say a certain date range) and return that as a table. easy peasey. Now that I'm trying to use that function inside another, i'm getting problems. I give the same input parameters to the 'encapsulating' function for want of a better word, and try and pass them inside my return(select ...) statement.The current syntax I have is like this:Create EncapsulatingFunction(@VarA datetime,@Varb Datetime)returns tableasreturn(select F.FieldA, F.FieldBfrom FilterFunction(@VarA,@VarB) F)there's some joining and stuff going on but you get the idea. The code is failing with the error:"The request for procedure 'FilterFunction' failed because 'FilterFunction' is a function object."I was under the impression that this was the whole point of UDFs!!Your thoughts, please! |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2005-03-09 : 06:31:08
|
| this seems to workCreate function a(@VarA datetime,@Varb Datetime)returns tableasreturn(select a= 1, b = 1from sysobjects)gocreate function b(@VarA datetime,@Varb Datetime)returns tableasreturn(select a,bfrom a(@VarA,@VarB) F)goselect * from b('20050101','20050101')==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
cokebaby666
Starting Member
7 Posts |
Posted - 2005-03-09 : 06:42:31
|
| My mistake, just got it working. Had a field left in that had been deleted from a table. Sorry for wasting your time. |
 |
|
|
|
|
|
|
|