红色部分没有问题, 错误的地方在 SET @ESERID=dbo.f_Next('OLTR_ExamStudentExamRecard') 楼主再看看f_Next方法里面是不是有问题
WHEN 'OLTR_ExamStudentExamRecard' THEN (SELECT (dbo.f_GetNext(0) + RIGHT(10001+ISNULL(RIGHT(MAX(ESERID),4),0),4)) as A FROM OLTR_ExamStudentExamRecard08 WITH(XLOCK,PAGLOCK) WHERE ESERID like dbo.f_GetNext(1) + '%' )
SELECT convert(varchar(2),getdate(),12)
declare @yy nvarchar(30) set @yy=getdate() set @yy=Year(@yy) set @yy=substring(@yy,3,2) select @yy 结果: 08
错误的地方在
SET @ESERID=dbo.f_Next('OLTR_ExamStudentExamRecard')
楼主再看看f_Next方法里面是不是有问题
(SELECT (dbo.f_GetNext(0) + RIGHT(10001+ISNULL(RIGHT(MAX(ESERID),4),0),4)) as A
FROM OLTR_ExamStudentExamRecard08 WITH(XLOCK,PAGLOCK)
WHERE ESERID like dbo.f_GetNext(1) + '%'
)
set @yy=Year(@yy)
set @yy=substring(@yy,3,2) select @yy
结果:
08
对象名 'OLTR_ExamStudentExamRecard09' 无效。
我日。怎么是09