Robert Magrogan (6/20/2011)
The following script can be used to add the TIME STAMP column to one table at a time.
ALTER TABLE yourtablename ADD TIMESTAMP
The below script will add the TIMESTAMP column to all tables in your database. WARNING! THIS WILL ALTER ALL YOUR TABLES! This script assumes you do not already have any TIMESTAMP columns in your tables.
DECLARE @TableName TABLE ( query VARCHAR(1000) )
INSERT INTO @TableName
SELECT 'Alter table ' + Name + ' ADD TimeStamp'
FROM sys.objects
WHERE Name <> 'dtProperties'
AND type = 'u'
--The below line is used to look at the data prior to executing it.
SELECT *
FROM @TableName
--WARNING - this script will ADD the TIMESTAMP COLUMNS TO ALL your tables!
--Comment out the RETURN line to auto run this script.
RETURN
DECLARE @sql VARCHAR(1000)
SET @sql = ''
WHILE EXISTS ( SELECT *
FROM @TableName
WHERE @TableName.query > @sql )
BEGIN
SELECT @sql = MIN(@TableName.query)
FROM @TableName
WHERE @TableName.query > @sql
EXEC(@sql)
END
You are going to grant permission to an Access Account to allow DDL?
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/