SQL中标准函数范例

 只做个人记录,不供大家学习。

USE [CRS_Brand]

GO

 

/****** Object:  UserDefinedFunction [dbo].[GetFactoryByID]    Script Date: 05/19/2013 21:59:44 ******/

SET ANSI_NULLS ON

GO

 

SET QUOTED_IDENTIFIER ON

GO

 

 

-- =============================================

-- Author:    peter qiu

-- Create date: 2013/05/15

-- Description:   <获取工厂名称>

-- =============================================

CREATE FUNCTION [dbo].[GetFactoryByID]

(

    @id uniqueidentifier

)

RETURNS varchar(50)

AS

BEGIN

    DECLARE @FactoryName varchar(100)

 

    SELECT @FactoryName=CompanyName from Factorys WHERE FactoryID=@id

 

    RETURN @FactoryName

END

GO

posted on 2013-05-19 22:02  秋天  阅读(491)  评论(0编辑  收藏  举报

导航