Qutestion on Alter Table

  • I am sure this is an easy one for the Guru's here. I have the following statements in a Stored Proc:

     

    ALTER TABLE ImportJobTool.dbo.tblQuotes ADD CompanyName varchar(255) NULL

    ALTER TABLE ImportJobTool.dbo.tblProjects ADD CompanyName varchar(255) NULL

    UPDATE ImportJobTool.dbo.tblQuotes SET CompanyName=tIns .Company FROM ImportJobTool.dbo.tblQuotes, ImportJobTool.dbo.tblInstaller tIns WHERE ImportJobTool.dbo.tblQuotes.InstallerID=tIns .InstallerID

    UPDATE ImportJobTool.dbo.tblProjects SET CompanyName=tIns.Company FROM ImportJobTool.dbo.tblProjects, ImportJobTool.dbo.tblInstaller tIns WHERE ImportJobTool.dbo.tblProjects.SecuredInstaller=tIns.InstallerID

    This will fail with a '...Column does not exist...' error when I try to save it (in Access 2000). If I add a 'GO' statement after the 'ALTER' statements I get a syntax error when I try to save it.

    Is this just a limitation in Access?

    Bill

    Thank-you
    Iceman
    No trees were harmed in the sending of this message, however a large number of electrons were terribly inconvenienced.

  • Sounds like the problem isn't with the ALTER statement but with Access. 

    I have to assume that you linked the tables into Access and have already ran the ALTER statement against your SQL tables.

    What you need to do is:

    1. Open the 2 tables and see that the new column is missing
    2. Re-run the Linked table add-in manager and select the 2 tables from the list. 
    3. Re-Open the 2 tables and see that the new column is now there

    Access doesn't automatically refresh the table structures when they are altered in SQL.  I don't think this is a limitation but more of a "the customer should know they changed something"......

    Hope this helped,

    AJ

     



    Good Hunting!

    AJ Ahrens


    webmaster@kritter.net

  • Thanks AJ.

    Thank-you
    Iceman
    No trees were harmed in the sending of this message, however a large number of electrons were terribly inconvenienced.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply