日期:2014-05-18  浏览次数:20683 次

看看这句存储过程错在哪...
是语法错误,应该怎么改?

insert     into     Article   (father_id,   author_id,   title,   text)  
values
(@father_id,   select     id       from     userinfo     where     username=@username,   @title,   @text)


谢谢~


------解决方案--------------------
declare @authorID int

select @authorID = id from userinfo where username=@username

insert into Article (father_id, author_id, title, text)
values
(@father_id, @authorID, @title, @text)
------解决方案--------------------
insert into Article (father_id, author_id, title, text)
values
(@father_id, select id from userinfo where username=@username, @title, @text)

SQL语法错误,不能这样用
可改为

insert into Article select @father_id, id , @title, @text from userinfo where username=@username