So, you ran a query and got the error message: An object or column name is missing or empty. For SELECT INTO statements, verify each column has a name.
As the above error message explains, you are trying to run a SELECT INTO statement without specifying a column name.
Consider the below example:
SELECT 1, 'TEST1' INTO #tblTest; GO
If you run the above T-SQL statement, you will get the “An object or column name is missing or empty.” error message.
If you specify column names in your SELECT INTO statement, then the query will run without the above error:
SELECT 1 AS ColumnName1, 'TEST1' AS ColumnName2 INTO #tblTest; GO
Other SQL Server troubleshooting articles to check on SQLNetHub:
- Error converting data type varchar to float
- Operating System Error 170 (Requested Resource is in use)
- There is no SQL Server Failover Cluster Available to Join
- Installing SQL Server 2016 on Windows Server 2012 R2: Rule KB2919355 failed
- Setup failed to start on the remote machine. Check the Task scheduler event log on the remote machine.
- A connection was successfully established with the server, but then an error occurred during the login process.
- SQL Server 2008 R2 Service Pack Installation Fails – Element not found. (Exception from HRESULT: 0x80070490)
- There is insufficient system memory in resource pool ‘internal’ to run this query.
- Argument data type ntext is invalid for argument …
- Could not load file or assembly ‘Microsoft.SqlServer.Smo, Version=10.0.0.0, …
- … more SQL Server troubleshooting articles
Rate this article:
Reference: SQLNetHub (https://www.sqlnethub.com)
© 2018 SQLNetHub
Recommended eBooks on SQL Server: