首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

这句是错哪了,找不到原因啊

2012-01-11 
这句是哪里错了,找不到原因啊?declare@employeesIntintset@employeesIntselectcount(*)fromemployeeswhe

这句是哪里错了,找不到原因啊?
declare   @employeesInt   int;
set   @employeesInt=select   count(*)   from   employees   where   month(birthdate)=month(getdate());

总是报错如下:
消息   156,级别   15,状态   1,第   2   行
关键字   'select '   附近有语法错误。

高手指点。

[解决办法]
declare @employeesInt int;
select @employeesInt=count(*) from employees where month(birthdate)=month(getdate());
[解决办法]
declare @employeesInt int;
set @employeesInt=(select count(*) from employees where month(birthdate)=month(getdate()));
[解决办法]
支持yesyesyes的 可以用set 但赋值时要把语句括起来
declare @employeesInt int;
set @employeesInt=(select count(*) from employees where month(birthdate)=month(getdate()));
print @employeesInt

热点排行