View Single Post
Join Date: Aug 2008
Posts: 1,162
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 137
dickersonka dickersonka is offline Offline
Veteran Poster

Re: SQL command to ALTER!! PLease Help

 
0
  #2
Sep 26th, 2008
i would create a stored procedure with a cursor

use this to get the table names

  1. SELECT name
  2. FROM dbo.sysobjects
  3. WHERE xtype = 'U'

and this dynamic sql to set key
  1. exec('alter table ' + @tablename + ' ADD PRIMARY KEY(osd)');
Custom Application & Software Development
www.houseshark.net
Reply With Quote