Thursday, 20 November 2014

Truncate all Table in sql command


SELECT 'TRUNCATE TABLE ' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES


Truncate number of table from Database:
 SELECT 'TRUNCATE TABLE ' + TABLE_NAME FROM CORD_DB.INFORMATION_SCHEMA.TABLES
where TABLE_NAME in (
  Select Table_Name from  Table_List where is_active='Y' and is_districtcode_add='N'
  ) order by TABLE_NAME