This is the script that is taking a very long time
USE [r_prod]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: Drew Borden
-- Create date: 4/16/2009
-- Description: Procedure to populated subdivision extract table
-- =============================================
IF EXISTS(SELECT * FROM sys.procedures WHERE name='sp_extract_subdivision')
BEGIN
DROP PROCEDURE sp_extract_subdivision
END
GO
CREATE PROCEDURE sp_extract_subdivision
@subdivsion_cd char(2)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
declare @strap varchar(25)
-- Clear existing record
delete from dbo.subdivision_extract
-- Select list of straps to loop through
declare strapList cursor for
select strap from dbo.parcel where county_cd = @subdivsion_cd
--Loop through straps and populate extract table values
BEGIN TRY
OPEN strapList
FETCH NEXT FROM strapList INTO @strap
WHILE @@FETCH_STATUS = 0
BEGIN
IF @strap IS NOT NULL
BEGIN
insert into dbo.subdivision_extract (acct_num) values (RTRIM(@strap))
exec sp_extract_parcel @strap
exec sp_extract_detail @strap
exec sp_extract_lnd_c @strap
exec sp_extract_parcel_flg @strap
exec sp_extract_owner @strap
exec sp_extract_mail @strap
exec sp_extract_legal_ln @strap
exec sp_extract_site @strap
exec sp_extract_condo_unit @strap
exec sp_extract_personal_x @strap
exec sp_extract_personal_x_dist @strap
exec sp_extract_phase_in @strap
exec sp_extract_p_tax_dist @strap
exec sp_extract_parcel_rel @strap
exec sp_extract_entzone @strap
exec sp_extract_dates @strap
exec sp_extract_sales @strap
exec sp_extract_sale_dtl @strap
exec sp_extract_pchar @strap
exec sp_extract_protest @strap
END
FETCH NEXT FROM strapList INTO @strap
END
CLOSE strapList
DEALLOCATE strapList
END TRY
BEGIN CATCH
SELECT ERROR_NUMBER() as ErrorNumber,
ERROR_MESSAGE() as ErrorMessage,
ERROR_PROCEDURE() as ExecutingProcedure,
ERROR_LINE() as LineNumber
CLOSE strapList
DEALLOCATE strapList
END CATCH
END
GO
Any way to speed this up?