Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005

    Exclamation Unanswered: A tricky one about ALTER TABLES

    I want to do the following query:

    ALTER TABLE Visitors DROP CONSTRAINT (SELECT szRelationship FROM MSysRelationships WHERE szColumn = VisitorCompany AND szReferencedColumn=Company_ID)

    It won't let me do it because it says "ALTER TABLE Syntax error"...

    There is a way to do this????

  2. #2
    Join Date
    Jan 2004
    Croatia, Europe
    Provided Answers: 5
    What database engine are you talking about? If it were Oracle, you'd do it this way:

    ALTER TABLE visitors DROP CONSTRAINT <constraint_name>;

    That is, you have to know constraints' name.

    I've never seen such a syntax, the one you used. Did you check ALTER TABLE command syntax in your DB? Does it really allow using a subquery?

    P.S. Sorry ... I found this topic on the SQL Forum; didn't notice it was moved to the Microsoft Access.
    However, subquery in ALTER TABLE looks very, very strange to me.
    Last edited by Littlefoot; 01-12-05 at 09:17.

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    Does this need to be done programatically? Is it something that needs to be done more than once?

    Personally I've never tried DDL changes in Access / JET, and there are better tools out there for SQL server

    if you don't need to do it by code, and it isn't soemthing that will occur moire than once I'd bit the buttle and doi it manually in the relationships window or a direct edit on the affected table

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts