Reputation: 295
I want to create a table in which the column names have spaces.
like
create table IDE_Dump(
Name varchar(255),
Head Name varchar(255),
Parent Account varchar (255)
);
The problem is to import bulk data from excel sheet to SQL Server 2008, whose headers are having the columns with spaces.
I have already tried ' ' or ` but its not working.
Upvotes: 12
Views: 33441
Reputation: 9053
You need to add []
brackets to column name.
CREATE TABLE IDE_Dump
(
Name VARCHAR(255),
[Head Name] VARCHAR(255),
[Parent Account] VARCHAR(255)
);
Or you can use double quotes ""
as jarlh commented:
CREATE TABLE IDE_Dump
(
Name VARCHAR(255),
"Head Name" VARCHAR(255),
"Parent Account" VARCHAR(255)
);
Upvotes: 21