Universal stored procedure. Find the deletion of unique records

zhaozj2021-02-16  93

?

/ * Name:?? SpAll_DeleteNoneUnique enter: table names and field list to the query output:? No call:?? SpAll_DeleteNoneUnique table names, field list Description: Common stored procedure finds delete non-unique record of:? Dili JF Senders e-mail? : dili@wellknow.net? http://www.wellknow.net? Update: 20040610? Support: http://bbs.wellknow.net? Copyright: Please indicate the source: Create future WellkNow .NET * / CREATE PROCEDURE Spall_DELETENONEUNIQUE / *? (?? @ parameter1 datatype = default value, ?? @ parameter2 datatype output?) * / (? @ TableName VARCHAR (50),? @ Fields VARCHAR (500)?) AS? Set nocount on

Declare @ssql varchar (1000)

? Set @ssql = 'select count (*) AS record number,'? Set @ssql = @ssql @fields? Set @ssql = @ssql 'from' @tablename? Set @ssql = @ssql 'Group BY ' @fields? Set @ssql = @ssql ' Having (count (*)> 1) '

? Print @ssql? - EXEC (@ssql)? - select * from stockReceivedq ?? set nocount OFF

Go

Posted on 2004

转载请注明原文地址:https://www.9cbs.com/read-12154.html

New Post(0)