编写剩下的存储过程

如增加新闻: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

posted @ 2013-12-11 22:00  小泽子  阅读(111)  评论(0编辑  收藏  举报