How to do ALTER TABLE after a DML sentece in the same transaction.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • NKN

    How to do ALTER TABLE after a DML sentece in the same transaction.

    Hi all,

    Does anybody know how could I manage to do a sentence like this...

    ALTER TABLE Table1 DROP COLUMN Col1

    after doing a DML sentence like and UPDATE, INSERT or DELETE.

    I'm using ADO commands to execute all thiis sentene from VB.

    The problem is that if all this is in the same transaction when I try
    droping the column in the same table that I've updated before I get an
    error. The object is locked and I can't drop the column.

    Thanks in advance for your suggestions,

    Naiara.
  • Trevor Best

    #2
    Re: How to do ALTER TABLE after a DML sentece in the same transaction.

    NKN wrote:[color=blue]
    > Hi all,
    >
    > Does anybody know how could I manage to do a sentence like this...
    >
    > ALTER TABLE Table1 DROP COLUMN Col1
    >
    > after doing a DML sentence like and UPDATE, INSERT or DELETE.
    >
    > I'm using ADO commands to execute all thiis sentene from VB.
    >
    > The problem is that if all this is in the same transaction when I try
    > droping the column in the same table that I've updated before I get an
    > error. The object is locked and I can't drop the column.
    >
    > Thanks in advance for your suggestions,
    >
    > Naiara.[/color]

    The need to drop a column from a table would suggest it's not in the
    right format to begin with, perhaps you just imported it? Try importing
    into an exiting table using an import spec that ignores the extra column
    from the external source.

    Otherwise if you've used that column for some temporary calculations and
    no longer need it, just leave it where it is and ignore it, e.g., use a
    query that selects all but that column.

    --
    This sig left intentionally blank

    Comment

    Working...