Search code examples
mysqlsqlsql-serverspace

How to create a column name with space in SQL Server


I want to create a column with a space in its name. In MySQL I just created this using back ticks, but in SQL Server that causes an error. Are there any possibilities to create a column name with a space?

I've tried the following but it doesn't work.

create table space_check
(
`roll num` int,
name varchar(50)
)

Can anybody tell me how to create this?


Solution

  • Use brackets in SQL-Server

    create table space_check
    (
      [roll num] int,
      name varchar(50)
    )