GetTableId SQL

USE [DEV]
GO
/****** Object:  UserDefinedFunction [dbo].[GetTableId]    Script Date: 12/21/2011 17:34:22 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:        <Macro.feng>
-- Create date: <2011-11-22 10:00>
-- Description:    <GetTableId>
-- =============================================
ALTER FUNCTION [dbo].[GetTableId](@tablename varchar(256))
RETURNS int
AS
BEGIN
    declare @tableId int
    select @tableId = tableid from SqlDictionary where fieldId = 0 and name = @tablename
    RETURN @tableId

END

posted @ 2011-12-21 17:35  perock  阅读(183)  评论(0编辑  收藏  举报