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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 User Defined Function returns a table ...

Author  Topic 

jtranier
Starting Member

1 Post

Posted - 2002-09-04 : 10:57:03
Hi,

I'm into a huge headeache:
I've to write an user defined function that have to return a table wich the
schema definition have to be switched between two possiblilites


--################################
CREATE FUNCTION dbo.GetTable(@Type int)
RETURNS @Result TABLE
(
--SIMPLE PROGRAMMATION LOGIC
if(@Type=1)
{
IdField int
ValueField char(100)
}
else
{
IdField int
ValueField text
}
--END OF SIMPLE PROGRAMATION LOGIC
)
AS
BEGIN
--... Identic code in both cases
RETURN
END
--################################

I hope that someone understand my problem and have some sort of solution, I
can try further explanation of the problem...

Thanks alot!

JoHN



   

- Advertisement -