CREATE TABLE MyTable (Col1 CHARACTER VARYING (50))Leave a comment
January 27, 2020 by Kenneth Fisher
If you read the title to this post and your first thought was That’s not SQL is it? then you had the same first thought I did when I saw it. But no, it’s valid. It turns out that CHARACTER VARYING is an ANSI Standard data type. SQL handles it as an alias to VARCHAR.
CREATE TABLE MyTable (Col1 CHARACTER VARYING (50)); GO EXEC sp_help MyTable;
If you are curious there are a fair number of other data type aliases and you can see them here.
In the end, the only real reason to know any of this is if you are reading someone’s code and they’ve used one of the aliases. At that point it would be nice to know what data type you are actually going to get.
Category: Microsoft SQL Server, SQLServerPedia Syndication | Tags: data types, Microsoft SQL Server