SQL SERVER – Msg 1038 – An Object or Column Name is Missing or Empty. For SELECT INTO Statements, Verify Each Column Has a Name

SQL
No Comments

Along with my freelance work as an independent consultant, I do keep an eye on various forums and look at issue reported with solutions so that I can blog about them to help the community. One of the Facebook group where I am active is SQLBangalore and recently once of the member posted an issue. He was trying to create a login using SQL Server Management Studio and getting error for SELECT INTO statement as below.

SQL SERVER - Msg 1038 - An Object or Column Name is Missing or Empty. For SELECT INTO Statements, Verify Each Column Has a Name login-error-01-800x554

Here is the text of the error message.

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)

Solarwinds

I was interested to know which command is raising the error, so I captured profiler and found below.

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

If we run above in the SSMS query window, we get below

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.

Now the error makes sense because login is created as [] and error clearly says that “…[] are not allowed…”

As explained by other members, it was due to the fact that login name was not given in the “general” tab. Anyone can reproduce the error by hitting OK on the login page without doing anything.

SOLUTION/WORKAROUND

In this situation, the issue was caused because of the empty login name. If we provide name, then the issue will be resolved.

Reference: Pinal Dave (https://blog.sqlauthority.com)

Solarwinds
, ,
Previous Post
Data Starvation – Balance Your SQL Server – Part 1
Next Post
SQL SERVER – Empty Startup Parameters in SQL Server Configuration Manager

Related Posts

Leave a Reply

Menu