create proc Esp_emobility_eEmployee_Register(@month datetime,@Company Nvarchar(20))
as
insert into Y_table_one(Y_company,Y_number,Y_age)
values(@Company,
(select count(Name) from (select Name from eEmployee_Event where year(Term)=year(@month) and MONTH(Term)=MONTH(@month) group by Name)as a ),
(select year(@month)-year(e2.BirthDate) as age from eEmployee_Event e1 left join eEmployee e2 on e1.EID=e2.EID))
go
我这个存储过程传参数的时候提示我的month类型是varchar型的,但是我强转类型还是不行,这是参数数据类型设置的问题吗?还是说sqlserver存储过程的参数只能定义int类型?
存储过程中的参数可以用SQL Server2000的任何一种数据类型(包括text和image),也可以用用户定义的数据类型定义存储过程参数