code_junkie

Sql: add a column to existing table and uniquely number them

Nov 11th, 2011
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. alter table Example
  2. add NewColumn int identity(1,1)
  3.  
  4. ALTER TABLE tableName ADD id MEDIUMINT NOT NULL AUTO_INCREMENT KEY
  5.  
  6. ALTER TABLE tableName ADD id SERIAL;
  7. ALTER TABLE tableName ADD PRIMARY KEY (id);
Add Comment
Please, Sign In to add comment