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.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 3,109 other followers

Follow me on Twitter

ToadWorld Pro of the Month November 2013
%d bloggers like this: