To declare the datatype for a column in a table:
CREATE TABLE [[database.]owner.]table_name
(column_name datatype [NOT NULL | NULL]
[, column_name datatype [NOT NULL | NULL]]...)
ALTER TABLE [[database.]owner.]table_name
ADD column_name datatype NULL
[, column_name datatype NULL...]
For complete syntax, see the CREATE TABLE and ALTER TABLE statements.
To declare the datatype for a local variable:
DECLARE @variable_name datatype
[, @variable_name datatype...]
For complete syntax, see the DECLARE statement.
To declare the datatype for a parameter in a stored procedure:
CREATE PROCedure [owner.]procedure_name[;number]
[(parameter1 [, parameter2]...[parameter255])]
[{FOR REPLICATION} | {WITH RECOMPILE}
[{[WITH] | [,]} ENCRYPTION]]
AS sql_statements
where
For complete syntax, see the CREATE PROCEDURE statement.
To change a value from one datatype to another:CONVERT (datatype[(length)], expression [, style])
For the complete CONVERT function syntax, see the Functions topic.