7 个解决方案
#1
select * from 案卷属性 where left(建立时间,4)=year(getdate())
#2
select * from 案卷属性 where year(建立时间) = year(getdate())
#3
select * from yourTable where convert(varchar(4),dateColumn,120) = 2006
#4
select * from yourTable where convert(varchar(4),dateColumn,120) = '2006'
#5
select * from wfzj.dob.案卷属性
where year(建立时间) = year(getdate())
where year(建立时间) = year(getdate())
#6
select * from yourTable where year(dateColumn) =year(getdate())
#7
select * from 案卷属性
where datepart(yy,建立时间)=datepart(yy,getdate())
where datepart(yy,建立时间)=datepart(yy,getdate())
#1
select * from 案卷属性 where left(建立时间,4)=year(getdate())
#2
select * from 案卷属性 where year(建立时间) = year(getdate())
#3
select * from yourTable where convert(varchar(4),dateColumn,120) = 2006
#4
select * from yourTable where convert(varchar(4),dateColumn,120) = '2006'
#5
select * from wfzj.dob.案卷属性
where year(建立时间) = year(getdate())
where year(建立时间) = year(getdate())
#6
select * from yourTable where year(dateColumn) =year(getdate())
#7
select * from 案卷属性
where datepart(yy,建立时间)=datepart(yy,getdate())
where datepart(yy,建立时间)=datepart(yy,getdate())