#+TITLE: Babel ECM #+DATE: 2011-06-28 #+DESCRIPTION: #+KEYWORDS: #+LANGUAGE: en_US #+LaTeX_CLASS: mcreport #+LaTeX_CLASS_OPTIONS: (final) #+BABEL: :eval never :engine msosql :cmdline -S cauchy -U sa -P LpmdlP -d pfi-paiestag -n -w 700 :results output :exports both :noweb yes * Introduction This library is an extensible *collection of* ready-made *code blocks* for handling common tasks. * "Generic" Transact-SQL ** Add a column into a table #+srcname: add-column-in-table[table, column, type, nullability] #+begin_src sql -- add column `$column' [if column does not exist yet] IF NOT EXISTS [SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$table' AND COLUMN_NAME = '$column'] BEGIN ALTER TABLE $table ADD $column $type $nullability END #+end_src