Book a Demo

Author Topic: Computed columns and Database Builder  (Read 3152 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Computed columns and Database Builder
« on: February 26, 2020, 12:48:23 pm »
One of our end-users has the following table definition:
Code: [Select]
CREATE TABLE [dbo].[Test](
       [Quantity] [float] NULL,
       [Price] [money] NULL,
       [Name] [nchar](10) NULL,
       [Revenue]  AS ([Quantity]*[Price])
) ON [PRIMARY]
GO
As can be seen it contains a computed column (Revenue).  He tried to reverse engineer it with DBB and any mention of computability disappeared.  Forward engineering then showed it was just a sim0ple float field.

Can such columns be reversed or forward engineered?  What is the appropriate syntax?  Is a Feature Request required?

TIA,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Richard Freggi

  • EA User
  • **
  • Posts: 498
  • Karma: +18/-7
    • View Profile
Re: Computed columns and Database Builder
« Reply #1 on: February 26, 2020, 03:20:52 pm »
I'm curious, as far as I can think, that's not DDL.  So, no.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Computed columns and Database Builder
« Reply #2 on: February 26, 2020, 04:21:35 pm »
I'm curious, as far as I can think, that's not DDL.  So, no.
It's part of SQL server DDL:
"A computed column is a virtual column that is not physically stored in the table unless the column is marked PERSISTED. A computed column expression can use data from other columns to calculate a value for the column to which it belongs. You can specify an expression for a computed column in SQL Server 2019"

However, the question has been asked before in the forum - as far back as 2005.  I was just hoping that with the new DBB functionality, the issue might have finally been resolved.

It would seem not.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!