凌寒飘香

____成风破浪会有时,直把云帆济沧海!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: :: 管理 ::

SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO

ALTER  FUNCTION f_NextTicketNo(@dt datetime)
RETURNS varchar(9)
AS
BEGIN
 DECLARE @ym varchar(4)
 SELECT @ym = CONVERT(varchar(4), @dt, 12)

 RETURN(
  SELECT @ym + RIGHT(100001 + ISNULL(RIGHT(MAX(Ticket_ID), 5), 0), 5)
  FROM CLS_HelpDesk_Tickets_New WITH(XLOCK,PAGLOCK)
  WHERE Ticket_ID like @ym+'%')
END


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

posted on 2007-05-17 14:58  凌寒飘香  阅读(234)  评论(0编辑  收藏  举报