update etilize_productattribute_temp set displayvalue = etilize_productattribute_update.displayvalue from etilize_productattribute_update where etilize_productattribute_update.productid = etilize_productattribute_temp.productid and etilize_productattribute_update.attributeid = etilize_productattribute_temp.attributeid and etilize_productattribute_update.categoryid = etilize_productattribute_temp.categoryid update etilize_productattribute_detail_temp set displayvalue = etilize_productattribute_update.displayvalue from etilize_productattribute_update where etilize_productattribute_update.productid = etilize_productattribute_detail_temp.productid and etilize_productattribute_update.attributeid = etilize_productattribute_detail_temp.attributeid and etilize_productattribute_update.categoryid = etilize_productattribute_detail_temp.categoryid update etilize_productattribute_detail_temp set displayvalue = 'BrightSign' FROM etilize_productattribute_detail_temp inner join etilize_product_temp on etilize_product_temp.productid = etilize_productattribute_detail_temp.productid and etilize_product_temp.manufacturerid = '1020722' WHERE (attributeid = '3211896') update etilize_productattribute_detail_temp set displayvalue = 'https://www.brightsign.biz/' FROM etilize_productattribute_detail_temp inner join etilize_product_temp on etilize_product_temp.productid = etilize_productattribute_detail_temp.productid and etilize_product_temp.manufacturerid = '1020722' WHERE (attributeid = '321451') update etilize_productattribute_temp set displayvalue = 'BrightSign' FROM etilize_productattribute_temp inner join etilize_product_temp on etilize_product_temp.productid = etilize_productattribute_temp.productid and etilize_product_temp.manufacturerid = '1020722' WHERE (attributeid = '3411896') update etilize_productattribute_temp set displayvalue = 'https://www.brightsign.biz/' FROM etilize_productattribute_temp inner join etilize_product_temp on etilize_product_temp.productid = etilize_productattribute_temp.productid and etilize_product_temp.manufacturerid = '1020722' WHERE (attributeid = '341451') CREATE INDEX attributenames_attributeID ON etilize_attributenames_temp (attributeid); GO CREATE INDEX attributenames_localeID ON etilize_attributenames_temp (localeid); GO Alter table etilize_attributenames_temp ADD CONSTRAINT etilize_attributenames_PK_temp PRIMARY KEY(attributeid); GO CREATE INDEX category_categoryID ON etilize_category_temp (categoryid); GO Alter table etilize_category_temp ADD CONSTRAINT etilize_category_PK_temp PRIMARY KEY(categoryid); GO CREATE INDEX categorydisplayattributes_hID ON etilize_categorydisplayattributes_temp (headerid); GO CREATE INDEX categorydisplayattributes_cID ON etilize_categorydisplayattributes_temp (categoryid); GO CREATE INDEX categorydisplayattributes_aID ON etilize_categorydisplayattributes_temp (attributeid); GO CREATE INDEX categoryheader_headerID ON etilize_categoryheader_temp (headerid); GO CREATE INDEX categoryheader_categoryID ON etilize_categoryheader_temp (categoryid); GO CREATE INDEX categorynames_categoryID ON etilize_categorynames_temp (categoryid); GO CREATE INDEX categorynames_localeID ON etilize_categorynames_temp (localeid); GO CREATE INDEX categorysearchattributes_aID ON etilize_categorysearchattributes_temp (attributeid); GO CREATE INDEX categorysearchattributes_cID ON etilize_categorysearchattributes_temp (categoryid); GO CREATE INDEX headernames_headerID ON etilize_headernames_temp (headerid); GO CREATE INDEX headernames_localeID ON etilize_headernames_temp (localeid); GO Alter table etilize_manufacturer_temp ADD CONSTRAINT etilize_manufacturer_PK_temp PRIMARY KEY(manufacturerid); GO Alter table etilize_product_temp ADD CONSTRAINT etilize_product_PK_temp PRIMARY KEY(productid); GO CREATE INDEX product_isAccessory ON etilize_product_temp (isaccessory); GO CREATE INDEX product_manufacturerID ON etilize_product_temp (manufacturerID); GO CREATE INDEX product_categoryID ON etilize_product_temp (categoryID); GO CREATE INDEX productaccessories_productID ON etilize_productaccessories_temp (productid); GO CREATE INDEX productaccessories_isPreferred ON etilize_productaccessories_temp (ispreferred); GO CREATE INDEX productacesories_acesoryPID ON etilize_productaccessories_temp (accessoryproductid); GO CREATE INDEX productdescriptions_productID ON etilize_productdescriptions_temp (productid); GO CREATE INDEX productdescriptions_localeID ON etilize_productdescriptions_temp (localeid); GO CREATE INDEX productsimilar_productID ON etilize_productsimilar_temp (productid); GO CREATE INDEX productsimilar_spID ON etilize_productsimilar_temp (similarproductid); GO CREATE INDEX productsimilar_localeID ON etilize_productsimilar_temp (localeid); GO CREATE INDEX productskus_productID ON etilize_productskus_temp (productid); GO CREATE INDEX productskus_localeID ON etilize_productskus_temp (localeid); GO CREATE INDEX productupsell_productID ON etilize_productupsell_temp (productid); GO CREATE INDEX productupsell_upsellProductID ON etilize_productupsell_temp (upsellproductid); GO CREATE INDEX productupsell_localeID ON etilize_productupsell_temp (localeid); GO Alter table etilize_search_attribute_values_temp ADD CONSTRAINT etilize_search_attribute_values_PK_temp PRIMARY KEY(valueid); GO CREATE INDEX search_attribute_productID ON etilize_search_attribute_temp (productid); GO CREATE INDEX search_attribute_attributeID ON etilize_search_attribute_temp (attributeid); GO CREATE INDEX search_attribute_valueID ON etilize_search_attribute_temp (valueid); GO CREATE INDEX search_attribute_absoluteValue ON etilize_search_attribute_temp (absolutevalue); GO CREATE INDEX search_attribute_isAbsolute ON etilize_search_attribute_temp (isabsolute); GO CREATE INDEX search_attribute_localeID ON etilize_search_attribute_temp (localeid); GO CREATE INDEX search_attrval_value ON etilize_search_attribute_values_temp (value); GO CREATE INDEX productattribute_productID ON etilize_productattribute_temp (productid); GO CREATE INDEX productattribute_categoryID ON etilize_productattribute_temp (categoryid); GO CREATE INDEX productattribute_attributeID ON etilize_productattribute_temp (attributeid); GO CREATE INDEX productattribute_localeID ON etilize_productattribute_temp (localeid); GO CREATE INDEX productattribute_detail_productID ON etilize_productattribute_detail_temp (productid); GO CREATE INDEX productattribute_detail_categoryID ON etilize_productattribute_detail_temp (categoryid); GO CREATE INDEX productattribute_detail_attributeID ON etilize_productattribute_detail_temp (attributeid); GO CREATE INDEX productattribute_detail_localeID ON etilize_productattribute_detail_temp (localeid); GO BEGIN TRANSACTION IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_attributenames') BEGIN DECLARE @reftable_1 nvarchar(60), @constraintname_1 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_attributenames' OPEN refcursor FETCH NEXT from refcursor into @reftable_1, @constraintname_1 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_1+' drop constraint '+@constraintname_1) FETCH NEXT from refcursor into @reftable_1, @constraintname_1 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_attributenames END ; GO EXEC sp_rename etilize_attributenames_temp, etilize_attributenames; GO DECLARE @pk SYSNAME; SELECT @pk = name FROM sysobjects WHERE parent_obj = object_id('etilize_attributenames') AND name LIKE '%PK_temp'; EXEC sp_rename @pk,'etilize_attributenames_PK'; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_category') BEGIN DECLARE @reftable_2 nvarchar(60), @constraintname_2 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_category' OPEN refcursor FETCH NEXT from refcursor into @reftable_2, @constraintname_2 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_2+' drop constraint '+@constraintname_2) FETCH NEXT from refcursor into @reftable_2, @constraintname_2 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_category END ; GO EXEC sp_rename etilize_category_temp, etilize_category ; GO DECLARE @pk SYSNAME; SELECT @pk = name FROM sysobjects WHERE parent_obj = object_id('etilize_category') AND name LIKE '%PK_temp'; EXEC sp_rename @pk,'etilize_category_PK'; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_categorydisplayattributes') BEGIN DECLARE @reftable_3 nvarchar(60), @constraintname_3 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_categorydisplayattributes' OPEN refcursor FETCH NEXT from refcursor into @reftable_3, @constraintname_3 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_3+' drop constraint '+@constraintname_3) FETCH NEXT from refcursor into @reftable_3, @constraintname_3 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_categorydisplayattributes END ; GO EXEC sp_rename etilize_categorydisplayattributes_temp, etilize_categorydisplayattributes ; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_categoryheader') BEGIN DECLARE @reftable_4 nvarchar(60), @constraintname_4 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_categoryheader' OPEN refcursor FETCH NEXT from refcursor into @reftable_4, @constraintname_4 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_4+' drop constraint '+@constraintname_4) FETCH NEXT from refcursor into @reftable_4, @constraintname_4 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_categoryheader END ; GO EXEC sp_rename etilize_categoryheader_temp, etilize_categoryheader ; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_categorynames') BEGIN DECLARE @reftable_5 nvarchar(60), @constraintname_5 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_categorynames' OPEN refcursor FETCH NEXT from refcursor into @reftable_5, @constraintname_5 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_5+' drop constraint '+@constraintname_5) FETCH NEXT from refcursor into @reftable_5, @constraintname_5 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_categorynames END ; GO EXEC sp_rename etilize_categorynames_temp, etilize_categorynames ; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_categorysearchattributes') BEGIN DECLARE @reftable_6 nvarchar(60), @constraintname_6 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_categorysearchattributes' OPEN refcursor FETCH NEXT from refcursor into @reftable_6, @constraintname_6 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_6+' drop constraint '+@constraintname_6) FETCH NEXT from refcursor into @reftable_6, @constraintname_6 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_categorysearchattributes END ; GO EXEC sp_rename etilize_categorysearchattributes_temp, etilize_categorysearchattributes ; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_headernames') BEGIN DECLARE @reftable_7 nvarchar(60), @constraintname_7 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_headernames' OPEN refcursor FETCH NEXT from refcursor into @reftable_7, @constraintname_7 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_7+' drop constraint '+@constraintname_7) FETCH NEXT from refcursor into @reftable_7, @constraintname_7 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_headernames END ; GO EXEC sp_rename etilize_headernames_temp, etilize_headernames ; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_manufacturer') BEGIN DECLARE @reftable_9 nvarchar(60), @constraintname_9 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_manufacturer' OPEN refcursor FETCH NEXT from refcursor into @reftable_9, @constraintname_9 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_9+' drop constraint '+@constraintname_9) FETCH NEXT from refcursor into @reftable_9, @constraintname_9 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_manufacturer END ; GO EXEC sp_rename etilize_manufacturer_temp, etilize_manufacturer ; GO DECLARE @pk SYSNAME; SELECT @pk = name FROM sysobjects WHERE parent_obj = object_id('etilize_manufacturer') AND name LIKE '%PK_temp'; EXEC sp_rename @pk,'etilize_manufacturer_PK'; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_product') BEGIN DECLARE @reftable_10 nvarchar(60), @constraintname_10 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_product' OPEN refcursor FETCH NEXT from refcursor into @reftable_10, @constraintname_10 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_10+' drop constraint '+@constraintname_10) FETCH NEXT from refcursor into @reftable_10, @constraintname_10 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_product END ; GO EXEC sp_rename etilize_product_temp, etilize_product ; GO DECLARE @pk SYSNAME; SELECT @pk = name FROM sysobjects WHERE parent_obj = object_id('etilize_product') AND name LIKE '%PK_temp'; EXEC sp_rename @pk,'etilize_product_PK'; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_productaccessories') BEGIN DECLARE @reftable_11 nvarchar(60), @constraintname_11 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_productaccessories' OPEN refcursor FETCH NEXT from refcursor into @reftable_11, @constraintname_11 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_11+' drop constraint '+@constraintname_11) FETCH NEXT from refcursor into @reftable_11, @constraintname_11 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_productaccessories END ; GO EXEC sp_rename etilize_productaccessories_temp, etilize_productaccessories ; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_productattribute') BEGIN DECLARE @reftable_12 nvarchar(60), @constraintname_12 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_productattribute' OPEN refcursor FETCH NEXT from refcursor into @reftable_12, @constraintname_12 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_12+' drop constraint '+@constraintname_12) FETCH NEXT from refcursor into @reftable_12, @constraintname_12 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_productattribute END ; GO EXEC sp_rename etilize_productattribute_temp, etilize_productattribute ; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_productattribute_detail') BEGIN DECLARE @reftable_122 nvarchar(60), @constraintname_122 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_productattribute_detail' OPEN refcursor FETCH NEXT from refcursor into @reftable_122, @constraintname_122 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_122+' drop constraint '+@constraintname_122) FETCH NEXT from refcursor into @reftable_122, @constraintname_122 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_productattribute_detail END ; GO EXEC sp_rename etilize_productattribute_detail_temp, etilize_productattribute_detail ; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_productdescriptions') BEGIN DECLARE @reftable_14 nvarchar(60), @constraintname_14 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_productdescriptions' OPEN refcursor FETCH NEXT from refcursor into @reftable_14, @constraintname_14 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_14+' drop constraint '+@constraintname_14) FETCH NEXT from refcursor into @reftable_14, @constraintname_14 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_productdescriptions END ; GO EXEC sp_rename etilize_productdescriptions_temp, etilize_productdescriptions; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_productsimilar') BEGIN DECLARE @reftable_18 nvarchar(60), @constraintname_18 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_productsimilar' OPEN refcursor FETCH NEXT from refcursor into @reftable_18, @constraintname_18 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_18+' drop constraint '+@constraintname_18) FETCH NEXT from refcursor into @reftable_18, @constraintname_18 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_productsimilar END ; GO EXEC sp_rename etilize_productsimilar_temp, etilize_productsimilar ; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_productskus') BEGIN DECLARE @reftable_19 nvarchar(60), @constraintname_19 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_productskus' OPEN refcursor FETCH NEXT from refcursor into @reftable_19, @constraintname_19 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_19+' drop constraint '+@constraintname_19) FETCH NEXT from refcursor into @reftable_19, @constraintname_19 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_productskus END ; GO EXEC sp_rename etilize_productskus_temp, etilize_productskus ; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_productupsell') BEGIN DECLARE @reftable_20 nvarchar(60), @constraintname_20 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_productupsell' OPEN refcursor FETCH NEXT from refcursor into @reftable_20, @constraintname_20 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_20+' drop constraint '+@constraintname_20) FETCH NEXT from refcursor into @reftable_20, @constraintname_20 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_productupsell END ; GO EXEC sp_rename etilize_productupsell_temp, etilize_productupsell ; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_search_attribute') BEGIN DECLARE @reftable_24 nvarchar(60), @constraintname_24 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_search_attribute' OPEN refcursor FETCH NEXT from refcursor into @reftable_24, @constraintname_24 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_24+' drop constraint '+@constraintname_24) FETCH NEXT from refcursor into @reftable_24, @constraintname_24 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_search_attribute END ; GO EXEC sp_rename etilize_search_attribute_temp, etilize_search_attribute ; GO IF EXISTS (SELECT 1 FROM sysobjects WHERE type = 'U' AND name = 'etilize_search_attribute_values') BEGIN DECLARE @reftable_25 nvarchar(60), @constraintname_25 nvarchar(60) DECLARE refcursor CURSOR FOR select reftables.name tablename, cons.name constraintname from sysobjects tables, sysobjects reftables, sysobjects cons, sysreferences ref where tables.id = ref.rkeyid and cons.id = ref.constid and reftables.id = ref.fkeyid and tables.name = 'etilize_search_attribute_values' OPEN refcursor FETCH NEXT from refcursor into @reftable_25, @constraintname_25 while @@FETCH_STATUS = 0 BEGIN exec ('alter table '+@reftable_25+' drop constraint '+@constraintname_25) FETCH NEXT from refcursor into @reftable_25, @constraintname_25 END CLOSE refcursor DEALLOCATE refcursor DROP TABLE etilize_search_attribute_values END ; GO EXEC sp_rename etilize_search_attribute_values_temp, etilize_search_attribute_values ; GO DECLARE @pk SYSNAME; SELECT @pk = name FROM sysobjects WHERE parent_obj = object_id('etilize_search_attribute_values') AND name LIKE '%PK_temp'; EXEC sp_rename @pk,'etilize_search_attribute_values_PK'; GO COMMIT TRANSACTION USE [Compsource] GO /****** Object: Index [_dta_index_etilize_search_attribute_6_73311571__K1_K2_K3] Script Date: 04/11/2014 09:09:01 ******/ CREATE NONCLUSTERED INDEX [_dta_index_etilize_search_attribute_6_73311571__K1_K2_K3] ON [dbo].[etilize_search_attribute] ( [productid] ASC, [attributeid] ASC, [valueid] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY] GO