ken82m Posted July 14, 2008 Share Posted July 14, 2008 (edited) Okay I have three databases two of which have almost 500 tables. All of which have been setup by an application. All the tables have a Column called "A4GLIdentity", I need to set this as the primary key in each table. I can use SQL Manager to export lists of tables for each DB to a text file. So that Makes things a bit easier. Server in question in MS SQL 2000 Anyone have any tips? My only alternative is carpal tunnel LOL muttley Thanks, Kenny Edited July 14, 2008 by ken82m "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
DaRam Posted July 14, 2008 Share Posted July 14, 2008 Not related to AutoIt, you would have had quicker/better responses posting to a SQL centric forum. Anyhoo.... For each of the 500 tables, you need to run ALTER TABLE <Table_Name> ADD PRIMARY KEY (A4GLIdentity); This will only work if A4GLIdentity is Set to "NOT NULL" in the table definitions. More info. here http://msdn.microsoft.com/en-us/library/aa...92(SQL.80).aspx Okay I have three databases two of which have almost 500 tables. All of which have been setup by an application. All the tables have a Column called "A4GLIdentity", I need to set this as the primary key in each table. I can use SQL Manager to export lists of tables for each DB to a text file. So that Makes things a bit easier. Server in question in MS SQL 2000 Anyone have any tips? My only alternative is carpal tunnel LOL muttley Thanks, Kenny Link to comment Share on other sites More sharing options...
ken82m Posted July 14, 2008 Author Share Posted July 14, 2008 Thank you very much Ram! That did it muttley You saved me alot of time. Your command and a little excel magic and just ran the commands. I actually did post a message in the MS SQL section on experts-exchange and they couldn't come up with a way for me to change them all. I knew AutoIT had some limited SQL support so just hoped someone might have something for me Thanks again, Kenny "I believe that when we leave a place, part of it goes with us and part of us remains... Go anywhere, when it is quiet, and just listen.. After a while, you will hear the echoes of all our conversations, every thought and word we've exchanged.... Long after we are gone our voices will linger in these walls for as long as this place remains." Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now