qb icon indicating copy to clipboard operation
qb copied to clipboard

computed columns break on sql server

Open Daemach opened this issue 3 years ago • 1 comments

The following code yields this error on SQL Server: Incorrect syntax near the keyword 'AS' - ALTER TABLE [rpt].[afterTaxBase] ALTER COLUMN [taxAlpha] AS ((portAfterTax-benchAfterTax)-(portPreTax-benchPreTax)) PERSISTED

schema.alter( "rpt.afterTaxBase", function( table ) { table.addColumn( table.smallinteger( "benchmarkID" ).nullable() ); table.addColumn( table.tinyinteger( "bmChange" ).nullable() );
table.addColumn( table.date( "inceptionDate" ).nullable() ); table.modifyColumn( 'taxAlpha', table.float( "taxAlpha" ).storedAs( "(portAfterTax-benchAfterTax)-(portPreTax-benchPreTax)" ) );
} );

Daemach avatar Oct 07 '21 12:10 Daemach