1
Vote

Computed column using CONVERT function incorrectly defined in intermediate table

description

There is an apparent bug in the way certain computed columns are recreated in the intermediate tables.

In my example below, PartitionManagement has added parentheses around the zero value parameter for the CONVERT function which do not exist in the original definition.

I have checked the original and the leftover intermediate table and the definitions shown in the trace are accurate.

This is a show stopper for me :(

philip

Trace -------------------
Microsoft.SqlServer.Management.Smo.FailedOperationException: Switch partition failed for Table 'Main.T_fare_observation_OMI'. ---> Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while executing a Transact-SQL statement or batch. ---> System.Data.SqlClient.SqlException: ALTER TABLE SWITCH statement failed. Computed column 'bpt_found_full' defined as '(CONVERT([int],[bpt_found](100000)+[bpt_found_sec],0))' in table 'Customer.Main.T_fare_observation_OMI' is different from the same column in table 'Customer.Main.T_fare_observation_OMI_part135_635125999135273412' defined as '(CONVERT([int],[bpt_found](100000)+[bpt_found_sec],(0)))'.
at Microsoft.SqlServer.Management.Common.ConnectionManager.ExecuteTSql(ExecuteTSqlAction action, Object execObject, DataSet fillDataSet, Boolean catchException)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
--- End of inner exception stack trace ---
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType)
at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries)
at Microsoft.SqlServer.Management.Smo.Table.SwitchPartitionImpl(Int32 sourcePartitionNumber, Table targetTable, Int32 targetPartitionNumber)
--- End of inner exception stack trace ---
at Microsoft.SqlServer.Management.Smo.Table.SwitchPartitionImpl(Int32 sourcePartitionNumber, Table targetTable, Int32 targetPartitionNumber)
at PartitionManagement.PartitionManager.ClearPartition(Boolean keepTable) in c:\Users\stuarto.NORTHAMERICA\Documents\Visual Studio 2012\Projects\PartitionManagement3.0\PartitionManagement\PartitionManagement.cs:line 277
at PartitionManagement.App.Run(AppArgs& parsedArgs) in c:\Users\stuarto.NORTHAMERICA\Documents\Visual Studio 2012\Projects\PartitionManagement3.0\PartitionManagement\ManagePartition.cs:line 201
Object reference not set to an instance of an object.

comments