
/****** Object:  UserDefinedFunction [dbo].[GetSeatCodeByUserCode]    Script Date: 05/30/2018 09:21:36 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GetSeatCodeByUserCode]') AND type in (N'FN', N'IF', N'TF', N'FS', N'FT'))
DROP FUNCTION [dbo].[GetSeatCodeByUserCode]
GO
/****** Object:  UserDefinedFunction [dbo].[GetSeatCodeByUserCode]    Script Date: 05/30/2018 09:21:36 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO





CREATE FUNCTION [dbo].[GetSeatCodeByUserCode] (
   @usercode nvarchar(50)
)  

RETURNS varchar(50)
AS  
BEGIN 
	declare @seatcode varchar(50)
	select @seatcode=F_ZXZCode from T_Sys_SeatGroup 
		where F_ZXZID=(select F_SeartGroupID from T_Sys_UserAccount where F_UserCode=@usercode )
	
	return @seatcode
END






GO


