Was this page helpful?
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Data Type Synonyms

SQL Server 2000

Data type synonyms are included for SQL-92 compatibility.

Synonym Mapped to system data type
Binary varying Varbinary
char varying Varchar
character Char
character char(1)
character(n) char(n)
character varying(n) varchar(n)
Dec decimal
Double precision float
float[(n)] for n = 1-7 real
float[(n)] for n = 8-15 float
integer int
national character(n) nchar(n)
national char(n) nchar(n)
national character varying(n) nvarchar(n)
national char varying(n) nvarchar(n)
national text ntext
rowversion timestamp

Data type synonyms can be used in place of the corresponding base data type name in data definition language (DDL) statements, such as CREATE TABLE, CREATE PROCEDURE, or DECLARE @variable. The synonyms have no visibility after the object is created, however. When the object is created, it is assigned the base data type associated with the synonym, and there is no record that the synonym was specified in the statement that created the object.

All objects derived from the original object, such as result set columns or expressions, are assigned the base data type. All subsequent meta data functions performed on the original object and any derived objects will report the base data type, not the synonym. This includes meta data operations, such as sp_help and other system stored procedures, the information schema views, or the various data access API meta data operations that report the data types of table or result set columns.

Data type synonyms also cannot be specified in the graphical administration utilities, such as SQL Server Enterprise Manager.

For example, you can create a table specifying national character varying:

CREATE TABLE ExampleTable (PriKey int PRIMARY KEY, VarCHarCol national character varying(10))

VarCharCol is actually assigned an nvarchar(10) data type, and all subsequent meta data functions will report it as an nvarchar(10) column. The meta data functions will never report them as national character varying(10) column.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft