0
Færdig

Define a computed column

Kindler Chase 10 år siden opdateret af anonymous 10 år siden 1
Is there a way to create a computed column, specifically for SQL Server? ex:

create table Entries
(
    Id int identity (1,1) not null,
    Process varchar(50) not null,
    ProcessDate datetime not null,
    Date as convert(date, ProcessDate),
    Time as convert(time, ProcessDate)
)

The last 2 columns are computed and I'd like to be able to define them with Vertabelo. Is that possible? If not, I'd like to suggest it as a feature.

Svar

Svar
Færdig
Well, you can define do this, but not straight. In "Table properties" you have a section called "Additional SQL scripts." You can add "After create table" statement like this:
ALTER TABLE Entries 
DROP COLUMN Date;

ALTER TABLE Entries
ADD Date AS convert(date, ProcessDate);

This way you'll have both visual representation on the diagram and the proper behavior (a computed column).
I know it's a kind of workaround but adding tons of options like this to our UI would make Vertabelo unusable.
GOD, JEG ER TILFREDS
Tilfredshedsangivelse af Kindler Chase 10 år siden
Svar
Færdig
Well, you can define do this, but not straight. In "Table properties" you have a section called "Additional SQL scripts." You can add "After create table" statement like this:
ALTER TABLE Entries 
DROP COLUMN Date;

ALTER TABLE Entries
ADD Date AS convert(date, ProcessDate);

This way you'll have both visual representation on the diagram and the proper behavior (a computed column).
I know it's a kind of workaround but adding tons of options like this to our UI would make Vertabelo unusable.

Kundesupport af UserEcho