Re: Returning table from UDF
From: Y.Makarounis (ymak_at_otenet.gr)
Date: 01/22/05
- Next message: anonymous_at_discussions.microsoft.com: "Re: Cursors in functions"
- Previous message: Michel Cadot: "Re: Detecting the INSERT format for DATE database fields?"
- In reply to: David Portas: "Re: Returning table from UDF"
- Next in thread: David Buchanan: "Re: Returning table from UDF"
- Reply: David Buchanan: "Re: Returning table from UDF"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 22 Jan 2005 11:11:24 +0200
Thank you David
My problem is the following:
I have certain tables to which apart from a standard number of fields
additional fields are added depending on customer requirements. A "Select *
>From Table_A" statement returns all fields but because there are several
versions of the same record in the table some quite elaborate filtering
(based on current criteria) is needed to get a single record. This results
in cubersome queries. So I was wondering if I could write a UDF which would
"hide" all the complication and call it as "Select * From
UDF_A(param1,param2,..)"?
What I already have done is write a UDF returning as a table the Ids of the
records satisfying the criteria and then using that to filter the original
table ie
"Select * From Table_A where Table_A.Id IN (Select Id From UDF_X(params))"
but it is still a litle complicated for "report writers" who don't know the
internals.
Yannis
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@acm.org> wrote in message
news:nbidnZWNSYMQ_2zcRVn-jA@giganews.com...
> No. Stored procedures can return variable numbers of columns though.
That's
> not to say that dynamic result sets from an SP is necessarily a good way
to
> accomplish things. Maybe if you describe your problem we can suggest a
> solution.
>
> --
> David Portas
> SQL Server MVP
> --
>
>
- Next message: anonymous_at_discussions.microsoft.com: "Re: Cursors in functions"
- Previous message: Michel Cadot: "Re: Detecting the INSERT format for DATE database fields?"
- In reply to: David Portas: "Re: Returning table from UDF"
- Next in thread: David Buchanan: "Re: Returning table from UDF"
- Reply: David Buchanan: "Re: Returning table from UDF"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|