Upgrades Questions on upgrading to version 7.x.
Version 7.x > Upgrades > An object or column name is missing or empty View modes: 
User avatar
Member
Member
kelly-lion - 9/20/2013 8:49:16 AM
   
An object or column name is missing or empty
After upgrading to 7 from 6 I get this error:
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.
Must declare the scalar variable "@".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: 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.
Must declare the scalar variable "@".

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): 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.
Must declare the scalar variable "@".]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +2085110
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5098184
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2294
System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
System.Data.SqlClient.SqlDataReader.get_MetaData() +86
System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +311
System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +987
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +141
System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +12
System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader(CommandBehavior behavior) +10
System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +144
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +319
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +94
CMS.DataProviderSQL.DataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction) +173

[Exception: [DataConnection.HandleError]: Query: UPDATE CMS_UserSettings SET [UserSettingsID] = @UserSettingsID, [UserNickName] = @UserNickName, [UserPicture] = @UserPicture, [UserSignature] = @UserSignature, [UserURLReferrer] = @UserURLReferrer, [UserCampaign] = @UserCampaign, [UserMessagingNotificationEmail] = @UserMessagingNotificationEmail, [UserCustomData] = @UserCustomData, [UserRegistrationInfo] = @UserRegistrationInfo, [UserPreferences] = @UserPreferences, [UserActivationDate] = @UserActivationDate, [UserActivatedByUserID] = @UserActivatedByUserID, [UserTimeZoneID] = @UserTimeZoneID, [UserAvatarID] = @UserAvatarID, [UserBadgeID] = @UserBadgeID, [UserShowSplashScreen] = @UserShowSplashScreen, [UserActivityPoints] = @UserActivityPoints, [UserForumPosts] = @UserForumPosts, [UserBlogComments] = @UserBlogComments, [UserGender] = @UserGender, [UserDateOfBirth] = @UserDateOfBirth, [UserMessageBoardPosts] = @UserMessageBoardPosts, [UserSettingsUserGUID] = @UserSettingsUserGUID, [UserSettingsUserID] = @UserSettingsUserID, [WindowsLiveID] = @WindowsLiveID, [UserBlogPosts] = @UserBlogPosts, [UserWaitingForApproval] = @UserWaitingForApproval, [UserDialogsConfiguration] = @UserDialogsConfiguration, [UserDescription] = @UserDescription, [UserUsedWebParts] = @UserUsedWebParts, [UserUsedWidgets] = @UserUsedWidgets, [UserFacebookID] = @UserFacebookID, [UserSkype] = @UserSkype, [UserIM] = @UserIM, [UserPhone] = @UserPhone, [UserPosition] = @UserPosition, [UserAuthenticationGUID] = @UserAuthenticationGUID, [UserBounces] = @UserBounces, [UserLinkedInID] = @UserLinkedInID, [UserLogActivities] = @UserLogActivities, [UserPasswordRequestHash] = @UserPasswordRequestHash, [UserAccountLockReason] = @UserAccountLockReason, [UserAvatarType] = @UserAvatarType, [UserInvalidLogOnAttempts] = @UserInvalidLogOnAttempts, [UserInvalidLogOnAttemptsHash] = @UserInvalidLogOnAttemptsHash, [UserPasswordLastChanged] = @UserPasswordLastChanged, [UserWebPartToolbarEnabled] = @UserWebPartToolbarEnabled, [UserWebPartToolbarPosition] = @UserWebPartToolbarPosition WHERE [] = @: caused exception: 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.
Must declare the scalar variable "@".]
CMS.DataEngine.AbstractDataConnection.HandleError(String queryText, SqlException ex) +90
CMS.DataProviderSQL.DataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction) +212
CMS.DataEngine.AbstractDataConnection.CMS.SettingsProvider.IDataConnection.ExecuteQuery(String queryText, QueryDataParameters queryParams, QueryTypeEnum queryType, Boolean requiresTransaction) +18
CMS.DataEngine.GeneralConnection.RunQuery(QueryParameters query) +175
CMS.DataEngine.GeneralConnection.ExecuteQuery(QueryParameters query) +388
CMS.DataEngine.GeneralConnection.ExecuteQuery(String queryName, QueryDataParameters parameters, String where, String orderBy, Int32 topN, String columns) +191
CMS.DataEngine.GeneralConnection.ExecuteQuery(String queryName, QueryDataParameters parameters) +21
CMS.DataEngine.SimpleDataClass.Update() +122
CMS.DataEngine.AbstractInfo`1.UpdateData() +158
CMS.Synchronization.SynchronizedInfo`1.UpdateData() +120
CMS.DataEngine.AbstractInfoProvider`2.SetInfo(InfoType info) +471
CMS.SiteProvider.UserSettingsInfoProvider.SetUserSettingsInfoInternal(UserSettingsInfo userSettings) +424
CMS.SiteProvider.UserInfoProvider.SetUserInfoInternal(UserInfo user) +968
CMS.CMSHelper.AuthenticationHelper.AuthenticateUser(String userName, String password, String siteName, Boolean login, AuthenticationSourceEnum source) +1393
CMS.MembershipProvider.CMSMembershipProvider.ValidateUser(String username, String password) +52
System.Web.UI.WebControls.Login.AuthenticateUsingMembershipProvider(AuthenticateEventArgs e) +60
System.Web.UI.WebControls.Login.OnAuthenticate(AuthenticateEventArgs e) +129
System.Web.UI.WebControls.Login.AttemptLogin() +127
System.Web.UI.WebControls.Login.OnBubbleEvent(Object source, EventArgs e) +101
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +125
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +167
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563

I have tried http://devnet.kentico.com/Knowledge-Base/Upgrading/Must-declare-the-scalar-variable-exception-after-u.aspx and that doesn't help.
I have also verified that I have collation set to mixed.

Any thoughts? This is after both a manual and a KIM guided upgrade.

User avatar
Member
Member
kelly-lion - 9/20/2013 9:05:01 AM
   
RE:An object or column name is missing or empty
Forgot to add, this is when I try to log in to the cmsdesk. Browsing the site works.

User avatar
Kentico Support
Kentico Support
kentico_zdenekc - 10/14/2013 3:47:29 PM
   
RE:An object or column name is missing or empty
Hello,

What do you mean by the "mixed" collation? We strongly recommend to use
SQL_Latin1_General_CP1_CI_AS collation.

This issue also similar to the older issue (that occured few times in 4.x and 5.x versions), as written in this
blogpost, so it might be a problem in the class schemas. Do you have some customizations to system tables or other system objects?

Thank you in advance for information.
Regards,
Zdenek


User avatar
Certified Developer 10
Certified Developer 10
josha-bpstudios - 10/24/2013 1:07:22 PM
   
RE:An object or column name is missing or empty
The problem is that your where statement is empty, and your select statement is trying to update the usersettingsid, which should be the where statement. This means that it is not set to be the primary key for the cms_usersettings table. Go into the database and check the cms_usersettings table. You will probably see that the usersettingsid(or whatever is supposed to be the primary field) is not marked as a primary key in the database.