Home Forums Microsoft Access Microsoft Access Slow performance after Migration from Access to SQL back-end RE: Slow performance after Migration from Access to SQL back-end

  • If you wanted to add a timestamp to every user table that does not already have one, you could use this script:

    SELECT 'ALTER TABLE [' + OBJECT_NAME(t.object_id) + '] ADD my_timestamp TIMESTAMP NOT NULL'

    FROM sys.tables t

    WHERE NOT EXISTS

    (

    SELECT 1

    FROM sys.columns

    WHERE system_type_id =

    (

    SELECT system_type_id

    FROM sys.types

    WHERE name = 'timestamp'

    )

    AND object_id = t.object_id

    )

    ANDt.type = 'U'

    ORDER BY 1

    which generates an ALTER script for each table...you would then inspect the list to remove any tables (e.g. import or staging tables) where adding a column would break something...and then you can run the ALTER scripts to add the timestamps & have a record of what was done.