Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1152 Issue Support Computed Columns #1155

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

slad08
Copy link

@slad08 slad08 commented Jan 21, 2020

I proposed decision problem from Issue 1152
#1152

@jzabroski
Copy link
Collaborator

I'm pretty sure even SQL Server 2008 supports computed columns, so why is this being introduced here as a Sql Server 2014 feature?

In terms of returning string.Empty, is that the right change? I think it might be, but it feels like we're co-opting two different meanings:

  1. No null behavior mentioned (in which case, it should probably default to NULL)
  2. If user uses AsCustom and doesn't specify null behavior, we're assuming we shouldn't display NULL.

What if instead of using column.CustomType, we instead introduced a new dimension, ComputedColumn? This would have the nice effect of, depending on the database, automatically generated the boilerplate for the computed column. For example, in Firebird, the syntax is:

alter table nums alter b generated always as (4*a + 7);

so you don't need " generated always as (" and the closing ");"

@jzabroski
Copy link
Collaborator

Thanks for your help, by the way.

@slad08
Copy link
Author

slad08 commented Jan 22, 2020

Thanks John, for you questions.
I answering for you questions:
"In terms of returning string.Empty, is that the right change? I think it might be, but it feels like we're co-opting two different meanings:
1.No null behavior mentioned (in which case, it should probably default to NULL)
2.If user uses AsCustom and doesn't specify null behavior, we're assuming we shouldn't display NULL."
My answeres:
SqlServer2014Column are overriding method FormatNullable for SqlServer2005Column and control Nullable property for this Server2014. By default if no null behavior mentioned and column Customer then nothing show, if NULL mentioned and column Customer - written NULL, or NOT NULL if mentioned Not Null. Such algorithm i meant.
I use now SQL server 2014 and i haven't opportunity for testing previous versions SQL server.
Maybe you have some own opinion about this?

@jzabroski
Copy link
Collaborator

I need to re-review this this week, but it probably won't make 3.2.7 release. I left a comment on #1152:

SET ANSI_NULL_DFLT_ON Modifies the behavior of the session to override default nullability of new columns when the ANSI null default option for the database is false.

@slad08

Maybe you have some own opinion about this?

I should have asked for tests on this but I also think I need to re-think what the right way to do this is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants