编写剩下的存储过程

如增加新闻:ALTER PROCEDURE [dbo].[news_insert]
@title varchar(100),
@content text,
@caid int 
AS
BEGIN
INSERT INTO news (title, [content], caId)
VALUES (@title,@content,@caid)
END

根据内容搜索新闻:

ALTER PROCEDURE [dbo].[news_selectByContent] @content varchar(1000) AS BEGIN  select top 10 n.id,n.title,n.createTime,c.[name] from news n  inner join category c on n.caId=c.id  where n.title like '%'+@content+'%'  order by n.createTime desc

END

原文地址:https://www.cnblogs.com/wangzenb/p/3470173.html