Publish: dropping index when it is used for foreign key constraint enforcement

Hi,
I'm trying to update a target schema from a reference database via Publish. Among the changes to apply, there's an index that needs to be dropped. Since it's linked to a foreign key constraint, it cannot be deleted unless the foreign key is temporarily dropped
(I saw somewhere that disabling the foreign key should be enough but it doesn't seem to work either).
Since there are other changes to be made on the same table, this foreign key also has to be dropped before the script can delete the table and re-create it. This part of the script is correctly generated. The problem is that this part appears after the 'DROP
INDEX' instruction.
So when generating the update script, SSDT tries to drop the index BEFORE dropping the foreign key. And I can't drop the foreign key in my custom pre-deployment script, otherwise the update script would fail when trying to delete it again.
Shouldn't SSDT be smart enough to drop the constraint before the index? Is it a bug or did I forget to set an option? If it's not a bug, what can I do apart from doing it manually?
Thank you for your help

Hi Elsa,
That sounds like a bug. Could you please file a Connect issue for this at
https://connect.microsoft.com/SQLServer/feedback/CreateFeedback.aspx using the category "Developer Tools (SSDT, BIDS, etc.)"? We're trying to track all bugs through
Connect so that you can tell when we have fixed the issue and we can request more information.
A workaround for this issue might be to write a pre-deployment script for your project to drop the foreign key prior to deployment. A pre-deployment script can be added to your project by right-clicking on the
project in solution explorer and then clicking on Add > Script... and selecting Pre-Deployment Script from the list.
Thanks!

Similar Messages

  • I don't know of there is anyone than can fix this age old Apple problem.   Does anyone know how to retrieve things under an old Apple ID when the email used for that account no longer exists? I am trying to update a number of apps that was bought under an

    I don't know of there is anyone than can fix this age old Apple problem.   Does anyone know how to retrieve apps under an old Apple ID when the email used for that account no longer exists & I can't remember the password? After speaking with Apple Acct. Security, I got the security Q right but my birthday was wrong! They wanted the serial number from my phone that was 3 iPhones ago! Seriously??!!
    Any updated way to work around this? No Apple people can correct it.
    Thanks,
    Joe

    You need to ask Apple to reset your security questions. To do this, click here and pick a method; if that page doesn't list one for your country or you're unable to call, fill out and submit this form.
    (122986)

  • What is the AlwaysFilter and when it is used for?

    What is the AlwaysFilter and when it is used for?
    Could you explain it in the details.
    Thank you

    jetq wrote:
    Sorry.
    cache.aggregate(AlwaysFilter.INSTANCE, new LongMin("getAge"))
    That doesn't really help.
    Where does AlwaysFilter come from? Is it part of the core API, or a 3rd party library? If the latter, which one? And in what do the API docs for this class not answer your question?

  • How can I get firefox to shut down automatically when not in use for an hour

    How can I get firefox to shut down automatically when not in use for an hour

    Sorry, there is no feature for that built into Firefox, and I haven't seen an add-on to add that feature to Firefox.

  • How AP behaves for withholding tax when vertax is used for tax calculation

    Hi,
    I am currently working on R12 implementation, I have requirement where business has to calculate the USE tax and withhold it from being paid to the supplier in case if use tax is not mentioned on the Invoice and pay it to tax authorities directly by business. Our client has Vertax third party tax engine. now the question is does it works same as it is in oracle payables in cases if client want to use vertax to calculate tax. How oracle behaves for withholding tax when vertax is used for tax calculations.
    Regards,
    Shashi.

    Hi
    Cheque Go to Menubar of  which document you have to  post for getting the WHT value  Menubar Settings - editing options -  remove the tick calculate tax on net amount.
    Rgds
    Vani

  • Generated Script fails when attempting to drop Foreign Key Constraint

    I made some changes to my database.  I used the generate script process to generate a drop and create script to these tables.  The generated script first ran Alter Table Drop Constraints to drop the Foreign Key constraints and then did Drop tables
    and then did create table to construct the script with the proper changes.
    However, when we attempted to run the script, all of the Drop constraint statements failed reporting that there was no such constraint.  Then the drop table scripts failed because of the existence of the very foreign key constraints  that SQL Server
    had just stated did not exist.
    BOL states that the statement "DROP { [ CONSTRAINT ] constraint_name | COLUMN column_name } " is  "Used in a CHECK, FOREIGN KEY, UNIQUE, or PRIMARY KEY constraint."  So why couldn't I drop those specified Foreign
    Key constraints in a script generated by SQL Server itself.
    Edward R. Joell MCSD MCDBA

    Are you sure there are no Constraints on other tables which are causing your issue?
    If a foreign key from table abc refences table def it will cause the drop to fail.
    If your script is already attempting to drop such constraints, have you checked that they are dropping from the correct table (and not the table that would be the target of the drop)?
    I discovered two things yesterday and one thing today about generated scripts.
    When you generated a script to drop and create a set of tables and you mark it to include foreign keys, the generated script will first create a set a scripts to drop the foreign keys , then will create a set of statements for each table that will,
    first, again drop the same foreign keys that it did earlier, then drop the table.  If there is no "if exists" statement for each statement, the drop constraint will fail.
    The script generated by the generate scripts wizard, even when you set the Drop and Create option in the advanced tab, unlike the scripts generated when you right click a table and select Drop and Create from the context menu, does not by default create
    an "If Exists" statement before the attempt to drop anything.
    You can make the generate Scripts wizard generate an "if exists" statement by changing the "Include if NOT EXISTS" option on the advanced tab to true. However, while the script generator will find all of the foreign keys that show that
    table as the parent_id, it will not show the FK constraints on tables which are not being dropped and created.  Nor can you find them by querying the sys.foreign_keys view using the standard type of Foreign Key "If Exists" statement because
    it would do a query like
    SELECT *
    FROM sys.foreign_keys
    WHERE object_id = OBJECT_ID(N'[dbo].[FK_prc_ContractSubLines_prc_PRSubLines]')
    AND parent_object_id = OBJECT_ID(N'[dbo].[prc_ContractSubLines]')
    And the script generator does not care even if you show an option like "Generate Scripts For Dependent Objects", it will not generate a drop script for the foreign constraints on other tables that reference your table.  I have not even found
    a way to get back the results of a query on the sys.foreign_keys view that will show those keys that reference your table. The only thing I been able to do is to open the table in design and check out the list of relationships in your table and see open each
    relationship and see which table is the "foreign key table" rather than the primary key table. This will make writing drop and create scripts very very long and tedious. As you would have to  create addional Alter tables scripts to do a drop
    and create foreign keys on each table referencing yours and manually place them into your scripts at correct locations. This is almost as bad as the Oracle SQL Developer's generate script results which (at least in 2010) so screws up the order of the generated
    script that it is trying to create foreign keys on tables it has not created yet.
    So Patrick I see that you thought about the foreign keys on other tables.  I wish I had read your post before spending the morning troubleshooting this issue based on this morning's script that ran and crashed embarrassingly. 
    I would like to know if someone has a query to reveal all of the foreign keys that reference your table from another table using the sys views.  As it is I have to open each table in design to get a list of FKs that reference it.
    Edward R. Joell MCSD MCDBA

  • Storage for Foreign Keys and Function based indexes

    This may well be the silliest question of the day, but is it possible to specify the storage for a Foreign key or a function based index? I'm not even sure that it would make sense.

    Well, a foreign key constraint is not a segment, nor is any other type of constraint. However, a function-based index is a segment, just like any other index. So, in that case, specify a tablespace, just like you would with any other index.
    Something like this:
    create index my_fbi on my_tab(upper(last_name)) tablespace my_index_tablespace;
    -Mark
    Message was edited by:
    mbobak
    Fixed minor typo.

  • Using FOreign key constraints on tables in database.

    I am student and novice in the field of ORACLE and PL/SQL and Database Creation. I had created a database consisting tables and got problem while applying foreign key constraints.
    CUST_MSTR
    CREATE TABLE "DBA_BANKSYS"."CUST_MSTR"("CUST_NO" VARCHAR2(10),
    "FNAME" VARCHAR2(25), "MNAME" VARCHAR2(25), "LNAME" VARCHAR2(25),
    "DOB_INC" DATE NOT NULL,      "OCCUP" VARCHAR2(25), "PHOTOGRAPH" VARCHAR2(25),
    "SIGNATURE" VARCHAR2(25), "PANCOPY" VARCHAR2(1),      "FORM60" VARCHAR2(1));
    (CUST_NO is PRIMARY KEY, )
    -- EMP_MSTR
    CREATE TABLE "DBA_BANKSYS"."EMP_MSTR"("EMP_NO" VARCHAR2(10),
    "BRANCH_NO" VARCHAR2(10), "FNAME" VARCHAR2(25), "MNAME" VARCHAR2(25),
    "LNAME" VARCHAR2(25), "DEPT" VARCHAR2(30), "DESIG" VARCHAR2(30));
    (EMP_NO is primary key )
    --NOMINEE_MSTR
    CREATE TABLE "DBA_BANKSYS"."NOMINEE_MSTR"("NOMINEE_NO" VARCHAR2(10),
    "ACCT_FD_NO" VARCHAR2(10), "NAME" VARCHAR2(75), "DOB" DATE,
    RELATIONSHIP" VARCHAR2(25));
    (NOMINEE_NO is primary key )
    --ADDR_DTLS
    CREATE TABLE "DBA_BANKSYS"."ADDR_DTLS"("ADDR_NO" NUMBER(6),
    "CODE_NO" VARCHAR2(10),      "ADDR_TYPE" VARCHAR2(1), "ADDR1" VARCHAR2(50),
    "ADDR2" VARCHAR2(50), "CITY" VARCHAR2(25), "STATE" VARCHAR2(25),
    "PINCODE" VARCHAR2(6));
    ( ADDR_NO is primary key )
    Problem: I want to apply foreign key constraints on ADDR_DTLS table so that Before inserting value in ADDR_DTLS table it must check, VALUE in ADDR_DTLS.CODE_NO must be PRESENT either in attribute value CUST_MSTR.CODE_NO or EMP_MSTR.CODE_NO or NOMINEE_MSTR.CODE_NO table .
    I applied the foreign key constraints using this syntax
    CREATE TABLE "DBA_BANKSYS"."ADDR_DTLS"("ADDR_NO" NUMBER(6),
    "CODE_NO" VARCHAR2(10),      "ADDR_TYPE" VARCHAR2(1), "ADDR1" VARCHAR2(50),
    "ADDR2" VARCHAR2(50), "CITY" VARCHAR2(25), "STATE" VARCHAR2(25),
    "PINCODE" VARCHAR2(6),
    constraints fk_add foreign key CODE_NO references CUST_MSTR. CODE_NO,
    constraints fk_add1 foreign key CODE_NO references EMP_MSTR. CODE_NO,
    constraints fk_add2 foreign key CODE_NO references NOMINEE_MSTR.CODE_NO);
    (foreign key)
    ADDR_DTLS.CODE_NO ->CUST_MSTR.CUST_NO
    ADDR_DTLS.CODE_NO ->NOMINEE_MSTR.NOMINEE_NO
    ADDR_DTLS.CODE_NO ->BRANCH_MSTR.BRANCH_NO
    ADDR_DTLS.CODE_NO ->EMP_MSTR.EMP_NO
    When I applied foreign key constraints this way, its gives a error called foreign key constraints violation. (I understand that, its searches the attribute value of ADDR_DTLS.CODE_NO in all the three tables must be present then the value will be inserted. But I want, if the value is in any of the three table then its should insert the value or its gives an error.)
    Please help me out, though i put the question and i want too know how to apply the forign key in this way. and is there any other option if foreign key implementation is not pssible.

    If you are on 11g you can use ON DELETE SET NULL:
    CREATE TABLE addr_dtls
    ( addr_no          NUMBER(6)  CONSTRAINT addr_pk PRIMARY KEY
    , addr_cust_no     CONSTRAINT addr_cust_fk    REFERENCES cust_mstr    ON DELETE SET NULL
    , addr_emp_no      CONSTRAINT addr_emp_fk     REFERENCES emp_mstr     ON DELETE SET NULL
    , addr_nominee_no  CONSTRAINT addr_nominee_fk REFERENCES nominee_mstr ON DELETE SET NULL
    , addr_type        VARCHAR2(1)
    , addr1            VARCHAR2(50)
    , addr2            VARCHAR2(50)
    , city             VARCHAR2(25)
    , state            VARCHAR2(25)
    , pincode          VARCHAR2(6) );In earlier versions you'll need to code some application logic to do something similar when a parent row is deleted, as otherwise the only options are to delete the dependent rows or raise an error.
    btw table names can be up to 30 characters and don't need to end with MSTR or DTLS, so for example CUSTOMERS and ADDRESSES might be more readable than CUST_MSTR and ADDR_DTLS. Also if the Customer/Employee/Nominee PKs are generated from a sequence they should be numeric.
    Edited by: William Robertson on Aug 15, 2010 6:47 PM

  • Use of foreign key check in ABAP reports

    Hi,
    I'm trying to understand if it's possible to use a foreign key integrity check in an ABAP reports. I have understood that this kind of check is deactivated for performance reasons, is it right?
    In this case I'd like to know if it is possible to activate the foreign key check "on demand", or just for a particular table.
    As an example, I'd like to use the foreign key defined on attribute AKONT of table KNB1, that points on the related attribute of table SKB1.
    Thanks,
    Gabriele

    Welcome on SCN!
    I'm trying to understand if it's possible to use a foreign key integrity check in an ABAP reports. I have understood that this kind of check is deactivated for performance reasons, is it right?
    Most likely yes. Integrity is turned OFF for Open SQL statements but is turned ON for screen fields.
    If you just create screen parameter like
    parameters pa_akont type knb1-akont.
    ...then input help for that field will be automatically provided. This means that you will not be able to pick or enter value different that this allowed from SKB1 table (foreign key relationship will be checked).
    You can explicitly assign different input help or search help for certain screen field independently of type it is refering i.e by means of fm F4IF_FIELD_VALUE_REQUEST .
    This however still relates only to screen fields, not fields used directly in ABAP statement.
    Regards
    Marcin

  • My mac is constantly  dropping my wi fi connection when not in use for a while - annoying.

    Recently my Mac has taken to dropping  the wi fi connection -  it seems to happen if the Mac isnt used for a short peiod of time say 10 mins or longer . It is very annoying and  it never used to do this. When you come back it tells you no connection and then  looks for the nework and says it cant find the prefeered one. I have reset newtork preferences to id/connect to  my home wi fi netowrk but the problem persists every time I ause use fora while. Really annoying. Is this something to do with a  recent OS software upgrade? Does Apple have a fix ? I am getting increasingly annoyed with  thier upgrades which are apparently  desighend to improve software but which  then degrade another apsect of performance. Any answers?

    Hi Bibii and welcome to Discussions,
    first of, you have posted in the Mac Pro section not the MacBook Pro section here http://discussions.apple.com/category.jspa?categoryID=190
    Anyway, is this really a shutdown or is it just sleeping ?
    If sleeping check the Energy Savings settings in the System Preferences for when your MBP should go to sleep when inactive.
    Regards
    Stefan

  • Does it makes sense to create an index on a column used for partitioning

    I am new to using partitions along with index. Can someone help me with the situation below?
    I have a table defined like below
    CREATE TABLE FACT_MASTER
    PERIODCODE NUMBER(8) NOT NULL,
    PRODUCT_CD NUMBER(10) NOT NULL,
    DPT_CD NUMBER(3),
    FACT_VALUE1 NUMBER,
    FACT_VALUE2 NUMBER,
    FACT_VALUE3 NUMBER,
    FACT_VALUE50 NUMBER
    PARTITION BY RANGE (PERIODCODE)
    partition P1 values less than (2002),
    partition P2 values less than (2003),
    partition P3 values less than (2004),
    This table is partitioned by range on Period code.
    In a select query on this table, period code and product code are being used. I am planning to create an index to boost the performance. Does it make sense to include the period code column also in the index? I am planning to create index only for the product code column. I am thinking that the partition itself will act like an index for periodcode. Can someone tell me if this is correct? I am using 10g.
    Edited by: user6794035 on Jan 21, 2010 8:47 AM
    Edited by: user6794035 on Jan 21, 2010 8:50 AM

    In your scenario I think it's better not to create an index on PERIODCODE because this column probaly has a only few distinct values.
    In other scenarios, when in the same partition there are many distinct values of the partitioning key, creating an index can be an advantage for query performances..
    But it depends on the specific context...
    Max
    [My Italian Oracle blog|http://oracleitalia.wordpress.com/2010/01/17/supporto-di-xml-schema-in-oracle-xmldb/]

  • How can I create a new entry without using LOV for foreign keys.

    Referring to TUHRA sample application based on HR database schema. JDeveloper 10.1.3.0.4
    How can I create a new employee without using LOV for the foreign key "job_id".
    On the first page I would like to choose the job_title from adf read-only table.
    After clicking on the "create new employee button" a creation form appears in which the job_id field is set with previous selection.
    Regards M.Winkler
    Edited by: user3541283 on 06.10.2008 03:44
    Edited by: user3541283 on 06.10.2008 03:50

    Hi,
    usually the foreign key is only set if the VO you select is dependent from a master. If e.g. you have DepartmentsVO1 that has an EmployeeVO3 as its nested VO, then creating a new instance of employees automatically add the foreign key. If you add EmployeesVO1, which is not dependent to DepartmensVO1, then the foreign key is not set. So if this is the case in THURA (keep in mind that this is not an Oracle demo but a sample used in a book about ADF) then all you need is to take the independent VO when building the new employee form.
    Frank

  • Table fields used for basic key figures in report writer/report painter

    Does anyone know how I can find which <u>table field</u> is actually being used for SAP defined <b>basic key figures</b> in report writer report? For example, <b>HSL</b> is a basic key figure for income statement, library 0F1, report 0F-GUVV. It only shows data is coming from table GLFUNCT. How does the report writer program knows which fields to select? What is the logic behind the basic key figures?
    Any advice is appreciated!!
    Minami

    I have now resolved this issue.
    I had to manually update TablesT804B and T804F. 
    I've added entries to T804A in the past without the need to update T804B or T804F manually so it appears that the way these tables work together has changed following an upgrade or application of support packs.
    Regards
    Mel

  • I downloaded 10.5.1 now I cannot open libraries from my external hardrive.  They are not highlighted when I open using the Option key

    I downloaded 10.5.1 now I cannot open libraries from my external hardrive.  They are not highlighted when I open using the Option key

    Hello, when you try Tylerdowner's reply make sure that you '''do not install Firefox using a limited Windows XP account''', you need sp2 and above in your xp.
    thank you

  • Use of Foreign Keys in MDM

    Hi All,
    Is there any mean by which we can use Foreign Keys in MDM.
    Sighting an example.
    We have 3 table with fields:
    Products(Main Table): Material No( UF)
    Product Regions(Flat): Marerial No ( Foreign Key),Region: Lookup
    Prices(Flat): Material No( Foreign Key),Region: Lookup(Foreign Key),Price Type: Lookup.
    How is it possible to achieve the above mentioned scenerio.
    And are Foreign Keys same as Unique Fields in MDM. 
    Thanks
    Manish
    Edited by: manish gupta on Mar 4, 2009 12:30 PM

    Hi Manish,
    MDM server sits on the database server.
    The database server is a DBMS.MDM repository does not work with the tables and fields structure in exactly the same way as an RDBMS.
    So we do not use in the real sense the same Primary key Unique key concept.However we have the linkup/lookup field concept in MDM.
    Where a field in the main table can reference another field in the lookup table.
    So if you relate this to the RDBMS concept.The primary field in one table is the Foriegn key in another table.So in the lookup table we can refer a field of the main table.
    say for eg:
    You have a field Regions in the main table of type lookup flat.
    This field is actually used in the lookup flat table say lookup regions.
    This table has a field regions which is holding a legal set of values.
    So the field Regions in main table is used in the Lookup table as well.Where in the main table it was the linking field and in the lookup table it is the field holding the lookup values.
    So you can to an extent relate these 2 concepts but it does not precisily work in the same way in MDM.
    Hope It Helped
    Thanks & Regards
    Simona Pinto

Maybe you are looking for

  • Crystal Report Load error

    Experts, I am getting the following error, while clicking on a button to load crystal report. Could not load file or assembly 'CrystalDecisions.CrystalReports.Engine, Version=12.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of it

  • Alerters in cross tab report

    Hi, I  have multiple crosstabs reports in a single tab each running on a different query. 1st cross tab I created a crosstab report which has Account names,in the left column, dates in the top row header and account data in the data cell. This report

  • I cannot print PDF's with XI on Windows7/ Dell XP and a Dell A940 Printer. Why ?I use to be able.

    I use to be able to print PDF's on an older version of Acrobat.Since I uploaded to XI , I cannot print from Adobe but I can print from Word and others .I have tried removing XI and going back to an older version with the same result. I get a prompt t

  • Problem starting ipip tunnel after reboot

    I have ipip tunnet and the netcfg profile looks like: CONNECTION='tunnel' DESCRIPTION='birds ipip tunnel' INTERFACE='BIRDS' MODE='ipip' REMOTE='82.*.*.*5' LOCAL='217.*.*.*4' IP='no' ROUTES=('10.0.11.0/24 dev BIRDS src 10.0.10.1') This tunnel interfac

  • BOBJ WEB Service Session - Login

    Hello Experts, I have to consume a BOBJ Web Service Session in SAP Netweawer. Hello, We have SAP NetWeaver 2004s and BusinessObjects Enterprise 12.0. I've created an proxy object on the SAP Netweaver side in the following way : se80->Create->Enterpri