代码如下,在sql server 2008R2下运行
- SQL code
create function account_count(@customer_name char(20)) returns integer as begin declare @a_count integer; select count(*) into @a_count --不知错在哪里了 from depositor where [email protected]_name return @a_count; end
报错:消息 102,级别 15,状态 1,过程 account_count,第 5 行
[email protected]_count' 附近有语法错误。
之前测试过问题出在select语句那里了
本人新手,希望各位高人帮忙
------解决方案--------------------
- SQL code
create function account_count(@customer_name char(20)) returns integer as begin declare @a_count integer; select @a_count=count(*) --不是oracle 不能那样给变量赋值 from depositor where [email protected]_name return @a_count; end