2015-03-13

TSQL - How to add multiple columns to a table at once (and how to drop them too)


-- Add
alter table [DATABASE_NAME].[SCHEMA_NAME].[TABLE_NAME]
add
       [FIELD_NAME_1] varchar(4) null
       , [FIELD_NAME_2] tinyint null
       , [FIELD_NAME_3] varchar(3) null
       , [FIELD_NAME_4] tinyint null
;


-- Drop
alter table STRESSTEST.dbo.TransactionStressed
drop column
       [FIELD_NAME_1]
       , [FIELD_NAME_2]
       , [FIELD_NAME_3]
       , [FIELD_NAME_4]
;



2015-03-03

Teradata - How to list all views (with their SQL definition)

select
       *
from
       dbc.tables
where
       1=1
       and tablekind='V'
       and databasename='CFDW2_RDL_ERIDL_CFS_VWS'
;