oldsport
oldsport

Reputation: 993

Insert into fields with special characters in the fieldname

I'm struggling with what I think is pretty basic stuff in SQL:

INSERT INTO CUSTOMERS ([First-Name], [Last-Name]) 
VALUES (@[First-Name], @[Last-Name])

If I choose a column name without a special character, and leave the square brackets aside, it works.

Is there perhaps a way to allow special characters some how, that I don`t need to work with square brackets? I'm working with Visual Studio 2013 and SQL Server Management Studio.

Thx

Upvotes: 0

Views: 227

Answers (1)

Sergio
Sergio

Reputation: 6948

There is a way NOT to use special characters. How about field name like !#$%? Why can't you just use some real notations like camelCase? I mean firstName, lastName, or first_name, last_name

Upvotes: 2

Related Questions