create view viw_CurrentMonthLessonList
As Declare @Year int
Declare @Month int
Set @Year=datepart(yy,getdate())
Set @Month=datepart(mm,getdate())
select * from Lessons
where id>@Year*1000000+@Month*10000-----------------------------服务器: 消息 156,级别 15,状态 1,过程 viw_CurrentMonthLessonList,行 4
在关键字 'Declare' 附近有语法错误。
执行后提示语法错误,我对Sql不是很熟悉,烦请指点?
As Declare @Year int
Declare @Month int
Set @Year=datepart(yy,getdate())
Set @Month=datepart(mm,getdate())
select * from Lessons
where id>@Year*1000000+@Month*10000-----------------------------服务器: 消息 156,级别 15,状态 1,过程 viw_CurrentMonthLessonList,行 4
在关键字 'Declare' 附近有语法错误。
执行后提示语法错误,我对Sql不是很熟悉,烦请指点?
create view viw_CurrentMonthLessonList
As select * from Lessons
where id> year(getdate())*1000000+month(getdate())*10000