|
CREATE FUNCTION [dbo].[GetCategoryName](@CategoryID int) RETURNS nvarchar(50) AS begin declare @CategoryName nvarchar(50)
SELECT @CategoryName = CategoryName from B_Categories WHERE CategoryID = @CategoryID RETURN @CategoryName end
select top 1 dbo.GetCategoryName(1) from B_Categories select * from B_Categories where CategoryName= dbo.GetCategoryName(1)
CREATE FUNCTION GetTable1() RETURNS @T1 TABLE (CatName NVARCHAR(50),ForumsName NVARCHAR(50)) AS BEGIN INSERT INTO @T1(CatName,ForumsName) SELECT Categories.CatName, Forums.ForumsName FROM Categories RETURN; END
|