Universal Storage process. Find the only non-deleted records
/ *
Name: spAll_DeleteNoneUnique
Input: to the table and the field List
Output:
Call: spAll_DeleteNoneUnique table, field List
Description: Universal Storage process. Find the only non-deleted records
Author: Dili JF Senders
E-mail: dili@wellknow.net
Web site: http://www.wellknow.net
Update: 20040610
Support: http://bbs.wellknow.net
Copyright: relaying, please specify the source: the creation of the future thinking 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 few records,'
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
Tags: storage








0 Comments to “Universal Storage process. Find the only non-deleted records”
No Comments. Send your comment.
Leave a Reply
You must be logged in to post a comment.