Function/Stored Proc

Function/Stored Proc

Post by Anith Se » Thu, 28 Nov 2002 02:01:08



I have no idea why you want to do something like this. In any
case you can simply use a CASE expression in your UDF like:


                   WHEN 'au_fname' THEN au_fname
                   WHEN 'phone' THEN phone
                   WHEN 'address' THEN address
       END
  FROM Pubs..authors

--
- Anith

 
 
 

Function/Stored Proc

Post by Bill Hollinshead [MS » Thu, 28 Nov 2002 05:53:30


Hi John,

It may be best to provide us with the big picture/goal <g>, otherwise, it
is very likely that both Anith and I are sending you "up the creek without
a paddle" <g>. Here's one alternative from
http://msdn.microsoft.com/library/en-us/createdb/cm_8_des_08_361x.asp:
{


   (
    ShipperID     int,
    ShipperName   nvarchar(80),
    OrderID       int,
    ShippedDate   datetime,
    Freight       money
   )
AS
BEGIN

        SELECT S.ShipperID, S.CompanyName,
               O.OrderID, O.ShippedDate, O.Freight
        FROM Shippers AS S INNER JOIN Orders AS O
              ON S.ShipperID = O.ShipVia

   RETURN
END

Quote:}

You can use the above example in conjunction with Anith's case statement.
Perhaps consider the use of sql_variant. Here's a modification of the above
example:
{

   (
    pkey  sql_variant
    , chosen_column sql_variant
   )

Quote:}

Thanks,

Bill Hollinshead
Microsoft, SQL Server

This posting is provided "AS IS" with no warranties, and confers no
rights. Subscribe to MSDN & use http://msdn.microsoft.com/newsgroups.

 
 
 

1. Stored Proc Calling Another Stored Proc

I have a table which has a child/parent relationship. I wrote a stored
procedure that returns all the children for any given record. I now want to
use this stored procedure in another stored procedure that will delete the
records retrieved from the first stored procedure. It sounds so simple, but
I'm stumped. How can I store the results from the first stored procedure
into a cursor that I can work with in the second stored procedure?

2. 7623-FL-MIAMI-UNIX-Budgeting Applications-Project Supervising-Systems Engineer

3. How to get results from Stored Proc within a Stored Proc

4. Voice Recognition & Pdoxwin?

5. How to call a stored Proc or Ext Stored proc /T-SQL UDF from VBScript

6. HELP!! ODBC errors..

7. calling stored proc from stored proc via variable

8. Calling a stored proc within a stored proc

9. Calling Stored Proc from other Stored Proc

10. Exec store proc within a store proc

11. a stored proc calling another stored proc

12. Executing a stored proc in a stored proc...