Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.
DECLARE @id int DECLARE @htid VARCHAR(1000) SET @htid = '71886,71887,71888,71889' DECLARE htid_cursor CURSOR FOR SELECT [str] FROM dbo.Parselist(@htid,',') OPEN htid_cursor; FETCH NEXT FROM htid_cursor INTO @id; -- Check @@FETCH_STATUS to see if there are any more rows to fetch. WHILE @@FETCH_STATUS = 0 BEGIN -- This is executed as long as the previous fetch succeeds. INSERT INTO [dbo].[EmailQueue] ( [Application] , [FromLine] , [ToLine] , [Subject] , [MessageSource] ) VALUES ( 'Test' , -- Application - varchar(255) 'firstname.lastname@example.org' , -- FromLine - varchar(3000) 'email@example.com' , -- ToLine - varchar(3000) 'Test Insert' , -- Subject - varchar(max) @id ); FETCH NEXT FROM htid_cursor; END CLOSE htid_cursor; DEALLOCATE htid_cursor;
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.