0

I have a storedProcedure in SQL-Server that I am using to delete duplicates from one of the tables. This storedprocedure makes use of a cursor.

I tried to create the same storedprocedure in microsoft access by just replacing the 'CREATE PROCEDURE' with 'CREATE PROC' but it didn't seem to work.

Can anyone provide some workaround?

Here is the SQL- storedprocedure:-

ALTER PROCEDURE [dbo].[csp_loginfo_duplicates] AS BEGIN

SET NOCOUNT ON;

declare @minrowid bigint 
declare @empid nvarchar(15) 
declare @dtpunched datetime 
declare @count tinyint

declare curDuplicate cursor for select empid,dtpunched,count(*),min(row_id) from loginfo group by empid,dtpunched having count(*)>1

open curDuplicate

fetch next from curduplicate into @empid,@dtpunched,@count,@minrowid

while (@@fetch_status=0) begin delete from loginfo where empid=@empid and dtpunched=@dtpunched and row_id<>@minrowid fetch next from curduplicate into @empid,@dtpunched,@count,@minrowid

end

close curDuplicate 
deallocate curDuplicate 
END
2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by thines01
0

What error did you get?
Were you trying to do this with code or just do it?
...or did you just want that stored proc for SQL Server converted?

The last time I created a stored proc with code, I used something like this:

"create proc InsTestNum2(inTestNum) AS INSERT INTO Test_Detail(test_no) values(inTestNum)"
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.