Microsoft SQL Server accept blank space in name of variables by usage of brackets:
CREATE TABLE [dbo].[MyDataTable](
[Compo 1] [nvarchar](50) NULL,
[Compo 2] [nvarchar](50) NULL,
[Compo 3] [nvarchar](50) NULL,
compo1 [nvarchar](50) NULL,
compo2 [nvarchar](50) NULL,
compo3 [nvarchar](50) NULL,
compo_1 [nvarchar](50) NULL,
compo_2 [nvarchar](50) NULL,
compo_3 [nvarchar](50) NULL)
Problem is what happens when a tool like entity framework or NHibernate or any other ORM tool or even manually I try to create a model based on my database?
When using C#, VB.NET, Java and probably most development language it is never possible to use white space in your variable name.
So, to fix this LINQPad default provider ignore and remove white space when generating C#, Linq2Db alternate provider seems to replace blanks by underscore. All these generation rules can conflict with other variable in my database in case I have a variable that already is the alternative solution like in my example.
In LINQPad I have this
MyDataTable.Compo1; // With capital letter and mapto [Compo 1] [nvarchar](50) NULL,
MyDataTable.compo2; // with small letter and map to compo2 [nvarchar](50) NULL,
MyDataTable.compo3;
MyDataTable.compo_1;
MyDataTable.compo_2;
MyDataTable.compo_3;
So, my questions: how is it possible that Microsoft accepted this as SQL valid column name? Is it part of SQL standard or specific to SQL Server? What can be a correct positive use cas of using blank in my column names?