1

Can you create an alias on field at time of creation? Example

 CREATE TABLE MYTABLE (                                           
    VERY_LONG_NAME       AS VLN  INT     NOT NULL )
James Hill
  • 60,353
  • 20
  • 145
  • 161
Mustapha George
  • 2,497
  • 9
  • 47
  • 79

1 Answers1

7

No.

Why create a table with a VERY_LONG_NAME and then alias it? Simply choose A_BETTER_NAME to begin with.

In addition, it would be quite confusing to have a DB where columns are accessible by multiple names. How would you know which name was the actual name and which was the aliased name?

EDIT

As per @DavidFabers suggestion, if you must name your column VERY_LONG_NAME, you could create a view to allow you/users to access the column by a shorter name:

CREATE VIEW [vwMyTable] AS 
    SELECT  VERY_LONG_NAME AS A_BETTER_NAME
    FROM    MyTable
James Hill
  • 60,353
  • 20
  • 145
  • 161
  • Agreed with the above. If you must do something of this sort then create a friendly view that end-users and developers can use. E.g. `CREATE VIEW myfriendlyview AS SELECT very_long_name AS vln FROM myunfriendlytable`. – David Faber Mar 21 '12 at 16:51