Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!
Declare @sql varchar(1000), @name varchar(1000) CREATE TABLE #id (id nvarchar(18) COLLATE SQL_Latin1_General_CP1_CI_AS) DECLARE cur_del CURSOR FOR SELECT name FROM #main OPEN cur_del FETCH NEXT FROM cur_del into @name WHILE @@FETCH_STATUS = 0 begin SET @sql = 'DELETE FROM ' + @name + ' WHERE id in (SELECT TOP 2 id FROM ' + @name + ')' exec (@sql) FETCH NEXT FROM cur_del INTO @name -- Get the next vendor. end CLOSE cur_del; DEALLOCATE cur_del;
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Moving away from Access 2003 adp files||4||48|
|Setting the order of SPROC returned recordset based on a passed paramter||34||39|
|Failover Cluster Primary Nodes Current Vote = 0||5||35|
|Microsoft SQL Query sum values over time periods||3||24|
Join the community of 500,000 technology professionals and ask your questions.