create procedure add_customer_info_tab
(
@param1 int,
@param2 varchar(24),
@param3 varchar(24),
@param4 varchar(24),
@param5 varchar(24),
@param6 varchar(24),
@param7 varchar(24),
@param8 varchar(24),
@param9 varchar(24),
@param10 varchar(24),
@param11 varchar(60),
@param12 varchar(1000),
)
as
delete from customer_info_tab where id=param1;
insert into customer_info_tab
(id,name,area,profession,vocation,company,approach,email,phone,mobile,interest,memo)
values(param1,param2,param3,param4,parma5,param6,param7,param8,param9,param10,param11,param12
消息 102,级别 15,状态 1,过程 add_customer_info_tab,第 15 行
')' 附近有语法错误
看了好半天就是不知道哪出了问题,我是SQL新手,麻烦多多指导
存储 sql
------解决方案--------------------
delete from customer_info_tab where id=@param1;
insert into customer_info_tab
(id,name,area,profession,vocation,company,approach,email,phone,mobile,interest,memo)
values(@param1,@param2,@param3,@param4,@parma5,@param6,@param7,@param8,@param9,@param10,@param11,@param12)
--少了@
------解决方案--------------------
create procedure add_customer_info_tab
(
@param1 int,
@param2 varchar(24),
@param3 varchar(24),
@param4 varchar(24),
@param5 varchar(24),
@param6 varchar(24),
@param7 varchar(24),
@param8 varchar(24),
@param9 varchar(24),
@param10 varchar(24),
@param11 varchar(60),
@param12 varchar(1000) -->这里多了逗号
)
as
set nocount on -->加这行屏闭消息
delete from customer_info_tab where id=param1;
insert into customer_info_tab
(id,name,area,profession,vocation,company,approach,email,phone,mobile,interest,memo)
values(param1,param2,param3,param4,parma5,param6,param7,param8,param9,param10,param11,param12)
go
------解决方案--------------------
后面insert 语句的values列表里面和delete语句的where后面的param,由于是传入存储过程的参数,都是在上面定义过的,必须要加上@符号,比如@param1。
另外,最后面少了一个')'右括号。
create procedure add_customer_info_tab
(
@param1 int,
@param2 varchar(24),
@param3 varchar(24),
@param4 varchar(24),
@param5 varchar(24),
@param6 varchar(24),
@param7 varchar(24),
@param8 varchar(24),
@param9 varchar(24),
@param10 varchar(24),
@param11 varchar(60),
@param12 varchar(1000),
)
as
delete from customer_info_tab where id=@param1;
insert into customer_info_tab
(id,name,area,profession,vocation,company,approach,email,phone,mobile,interest,memo)
values(@param1,@param2,@param3,@param4,@parma5,@param6,@param7,@param8,
@param9,@param10,@param11,@param12)
------解决方案--------------------
都少了@
create procedure add_customer_info_tab
(
@param1 int,
@param2 varchar(24),
@param3 varchar(24),
@param4 varchar(24),
@param5 varchar(24),
@param6 varchar(24),
@param7 varchar(24),
@param8 varchar(24),
@param9 varchar(24),
@param10 varchar(24),
@param11 varchar(60),
@param12 varchar(1000) -->这里多了逗号
)
as
set nocount on -->加这行屏闭消息
delete from customer_info_tab where id=param1;
insert into customer_info_tab
(id,name,area,profession,vocation,company,approach,email,phone,mobile,interest,memo)
values(@param1,@param2,@param3,@param4,@param5,@param6,@param7,@param8,@param9,@param10,@param11,@param12) --都少了@
go