现在位置:
首页 > SQL Server > 正文
返回补考课程名称字符串
- USE [TMS]
- GO
- /****** Object: UserDefinedFunction [dbo].[ufn_GetLessonNames] Script Date: 10/27/2013 15:28:56 ******/
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: hxl
- -- Create date: 2013-10-27
- -- Description: 返回补考课程名称字符串
- -- update[1]:
- -- =============================================
- ALTER FUNCTION [dbo].[ufn_GetLessonNames] ( @StudentID INT )
- RETURNS NVARCHAR(1000)
- AS
- BEGIN
- DECLARE @tempString NVARCHAR(1000)
- SET @tempString = ''
- SELECT @tempString = @tempString + '、' + ts.LessonName
- FROM dbo.Scores s
- LEFT JOIN dbo.v_TeachplanSub ts ON ts.TeachplansSubID = s.TeachplansSubID
- WHERE s.IsSubmited = 1
- AND s.ScoreSubmited < 60
- AND s.StudentID = @StudentID
- ORDER BY s.CreateDate
- RETURN(STUFF(@tempString,1,1,''))
- END
怎么没人看呢,太可惜了,支持你!