How can I create a blank/hardcoded column in a sql query?

前端 未结 6 833
刺人心
刺人心 2020-12-15 15:39

I want have a query with a column that is a hardcoded value not from a table, can this be done? I need it basically as a placeholder that I am going to come back to later a

6条回答
  •  感情败类
    2020-12-15 16:25

    For varchars, you may need to do something like this:

    select convert(varchar(25), NULL) as abc_column into xyz_table
    

    If you try

    select '' as abc_column into xyz_table
    

    you may get errors related to truncation, or an issue with null values, once you populate.

提交回复
热议问题