Databases Reference
In-Depth Information
SELECT * FROM table WHERE column1 LIKE '%string%'
Compare a string value where the compared string is at the beginning of the string:
SELECT * FROM table WHERE column1 LIKE 'string%'
Compare a string value where the compared string is at the end of the string:
SELECT * FROM table WHERE column1 LIKE '%string'
Compare a string value where a specific character or character range is in the string:
SELECT * FROM table WHERE column1 LIKE '[a-c]'
SELECT * FROM table WHERE column1 LIKE '[B-H]olden'
Compare a string value where a specific character or character range is not in the string:
SELECT * FROM table WHERE column1 LIKE '[M^c]%' -Begins with M but not Mc
ALTER TABLE
Alter the structure of a table by adding or removing table objects such as Constraints, Columns, and
Partitions or enabling and disabling Triggers.
ALTER TABLE table_name ADD new_column int NULL
ALTER TABLE table_name ADD CONSTRAINT new_check CHECK (check expression)
ALTER TABLE table_name DISABLE TRIGGER trigger_name
ALTER TABLE table_name ENABLE TRIGGER trigger_name
CREATE DATABASE
Create a database and all associated files:
CREATE DATABASE new_database
ON (
NAME = 'logical_name',
FILENAME = 'physical_file_location',
SIZE = initial_size_in_MB,
MAXSIZE = max_size_in_MB, --If no MAXSIZE specified unlimited growth is assumed
FILEGROWTH = percentage_OR_space_in_MB)
LOG ON
( NAME = 'logical_log_name',
FILENAME = 'physical_file_location',
SIZE = initial_size_in_MB,
MAXSIZE = max_size_in_MB, --If no MAXSIZE specified unlimited growth is assumed
FILEGROWTH = percentage_OR_space_in_MB)
COLLATE database_collation
CREATE DEFAULT
Create a database-wide default value that can then be bound to columns in any table to provide a
default value.
Search WWH ::




Custom Search