declare @employeesInt int;
set @employeesInt=select count(*) from employees where month(birthdate)=month(getdate());总是报错如下:
消息 156,级别 15,状态 1,第 2 行
关键字 'select' 附近有语法错误。高手指点。
set @employeesInt=select count(*) from employees where month(birthdate)=month(getdate());总是报错如下:
消息 156,级别 15,状态 1,第 2 行
关键字 'select' 附近有语法错误。高手指点。
select @employeesInt=count(*) from employees where month(birthdate)=month(getdate());
declare @employeesInt int;
select @employeesInt=count(*) from employees where datepart(mm,birthdate)=datepart(mm,getdate());
为什么set却不行呢?
set @employeesInt=(select count(*) from employees where month(birthdate)=month(getdate()));
declare @employeesInt int;
set @employeesInt=(select count(*) from employees where month(birthdate)=month(getdate()));
print @employeesInt
set @employeesInt=(select count(*) from employees where month(birthdate)=month(getdate()));
select @employeesInt= count(*) from employees where month(birthdate)=month(getdate());