---
title: "批量删除"
author: "epai"
date: "2010-05-20T10:21:39Z"
tags: []
categories: ["数据库"]
slug: "untitled"
draft: false
lastmod: "2010-05-20T10:21:39Z"
id: 670447
url: "https://epai.iteye.com/blog/670447"
---

USE \[Publishing System ]  
GO  
/\*\*\*\*\** Object:  StoredProcedure \[dbo].\[Procdeletesomenews]    Script Date: 05/12/2010 10:07:19 \*\*\*\*\*\*/  
SET ANSI\_NULLS ON  
GO  
SET QUOTED\_IDENTIFIER ON  
GO  
\-- =============================================  
\-- Author:  韩慧  
\-- Create date: &lt;Create Date,,&gt;  
\-- Description: &lt;Description,,&gt;  
\-- =============================================  
ALTER PROCEDURE \[dbo].\[Procdeletesomenews]  
  @delId nvarchar(200)  
   
AS  
BEGIN  
 --需要先删除评论才能删除新闻

 --删除新闻

   declare   @deln   nvarchar(4000)    
   declare   @delc   nvarchar(4000)  
  set @delc = 'delete from comment where newsid in  (['+@delId+')'](mailto:%27+@delId+%27%29%27)   --定义sql语句  
  set @deln = 'delete from news where id in  (['+@delId+')'](mailto:%27+@delId+%27%29%27)  
  exec(@delc)    
  exec(@deln)  

END