Monday, January 13, 2014

Add multiple columns to all the tables in the database.



Add multiple columns to all the tables in the database.

Script:

select 'Alter Table ' + TABLE_NAME + ' ADD '
        + ' Column_Name1 Datatype  ,'
        + ' Column_Name1 Datatype  '
        + CHAR(10) + ' GO '
from INFORMATION_SCHEMA.TABLES
Steps:

  • Select the database and Copy the about given Script
  • Select the Result in Text View
  • Run the script
  • Copy the Script and Execute it.



Thanks & Regards,
Karthikeyan Jothi.
"You Never Fail Until You Stop Trying"

No comments:

Post a Comment