21.10.09

Special symbols in the column names in sql server table

Usage of special characters and keywords as the column name:

It's obvious that, we used to use keywords or special characters in the column name. SQL Server won't permit us to use the same directly. In that case, they will provide an option (Brackets [ ]) to use it.

Let see our example,

create table venkattable(kg/m varchar(10))

Output:

Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '/'.



To resolve this issue, I have used brackets.

create table venkattable([kg/m] varchar(10))

Output:

Command(s) completed successfully.

Thanks and Regards,
Venkatesan Prabu .J

No comments:

Post a Comment