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

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)"
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.