Published on

October 4, 2017

Understanding SQL Server Login Creation Error

As a freelance SQL Server consultant, I often come across various issues reported by the community. Recently, a member of the SQLBangalore Facebook group posted an error they encountered while trying to create a login using SQL Server Management Studio. The error message stated: “An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as “” or [] are not allowed. Change the alias to a valid name.” (Microsoft SQL Server, Error: 1038)

Curious to understand the cause of the error, I captured the profiler and found the following command:

CREATE LOGIN [] FROM WINDOWS WITH DEFAULT_DATABASE=[master]

Running the above command in the SSMS query window resulted in the following error:

Msg 1038, Level 15, State 4, Line 1
An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name. For other statements, look for empty alias names. Aliases defined as "" or [] are not allowed. Change the alias to a valid name.

Upon analyzing the error, it became clear that the login was being created with an empty name, which is not allowed according to the error message. As other members of the group pointed out, this error can be reproduced by simply clicking “OK” on the login page without providing a name.

Solution/Workaround

In this particular situation, the issue was caused by the empty login name. Providing a valid name resolves the error. It is important to ensure that all required fields, such as the login name, are properly filled out when creating a login in SQL Server Management Studio.

By being aware of this error and its solution, you can avoid encountering similar issues when creating logins in SQL Server. Remember to always provide a valid name and fill out all necessary fields to ensure a smooth login creation process.

Click to rate this post!
[Total: 0 Average: 0]

Let's work together

Send us a message or book free introductory meeting with us using button below.