Is it possible to prevent the SQL Producer from overwriting just one of the tables columns?

Dave

Scenario: A computed property needs to available for RAW methods. The IsComputed property set in the model will not work as its value will not be available to RAW methods.

Attempted Solution: Create a computed column directly on the SQL table as opposed to setting the IsComputed property in the model. Specify that CodefluentEntities not overwrite the computed column. I would than expect the BOM to read the computed SQL field no differently than if it was a normal database field.

Problem: I can't figure out how to prevent Codefluent Entities from overwriting the computed column. I attempted to use the production flags as well as setting produce="false" for the property in the .cfp. Neither worked.

Question: Is it possible to prevent Codefluent Entities from overwriting my computed column and if so, how?

Dave

Alternate Solution: An alternate solution is to execute the following the TSQL script after the SQL Producer finishes generating.

ALTER TABLE PunchCard DROP COLUMN PunchCard_CompanyCodeCalculated
GO

ALTER TABLE PunchCard
ADD PunchCard_CompanyCodeCalculated AS CASE
       WHEN PunchCard_CompanyCodeAdjusted IS NOT NULL THEN PunchCard_CompanyCodeAdjusted
       ELSE PunchCard_CompanyCode
END

GO 

Additional Configuration Needed to Make Solution Work: In order for this solution to work one must also configure the BOM so that it does not attempt to save the data associated with the computed columns. This can be done through Model using the advanced properties. In my case I selected the CompanyCodeCalculated property. Went to advanced settings. And set the Save setting to False.

Question: Somewhere in the Knowledge Center there is a passing reference on how to automate the execution SQL Scripts after the SQL Producer finishes but I can not find it. Anybody now how this is done?

Post Usage Comments: Just wanted to let people know I implemented this approach and am so far happy with the results.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Compare columns from multiple tables in one query PHP/SQL

From Dev

SQL. This one involves multiplying two columns from different tables

From Dev

Add multiple columns from different tables in SELECT statement using a GROUP BY with just one parameter

From Dev

Prevent tables from breaking over a page, if possible

From Dev

SQL: Multiplying two columns(from different tables) and Inserting/Updating(one of the tables)

From Dev

Redirection not overwriting file but just producing a blank one

From Dev

Combining two columns from separate tables into one in SQL Oracle SQL developer

From Dev

Merge two columns from two tables into one

From Dev

sql query to select just one from the pair

From Dev

SQL Server. Join two tables n a view, take rows from one and turn into columns

From Dev

sql - how to select multiple columns with only one distinct column from joining multiple tables

From Dev

Oracle SQL: Can I combine columns from different tables into one table?

From Dev

How can I merge rows and columns from two sql tables into one table

From Dev

Prevent Microsoft Word from wrapping tables across columns and pages

From Dev

Is it possible to replace the following two SQL selects with just one?

From Dev

Is it possible to compare tables from different SQL server?

From Dev

SQL IN operator for multiple columns from different tables

From Dev

Merging columns from identical tables in SQL

From Dev

sql concat columns from different tables

From Dev

SQL Pivot from multiple tables and columns

From Dev

Get columns from two tables sql

From Dev

SQL Stored Procedure - Columns From Three Tables?

From Dev

Sql sum() columns from different tables

From Dev

QUERYING columns from 3 tables using SQL

From Dev

How to prevent automake from overwriting INSTALL?

From Dev

Prevent ffmpeg from overwriting existing output file

From Dev

Prevent user from overwriting the record CRM 2011

From Dev

SQL query from two tables ordering results by both tables columns

From Dev

One update SQL query from three tables

Related Related

  1. 1

    Compare columns from multiple tables in one query PHP/SQL

  2. 2

    SQL. This one involves multiplying two columns from different tables

  3. 3

    Add multiple columns from different tables in SELECT statement using a GROUP BY with just one parameter

  4. 4

    Prevent tables from breaking over a page, if possible

  5. 5

    SQL: Multiplying two columns(from different tables) and Inserting/Updating(one of the tables)

  6. 6

    Redirection not overwriting file but just producing a blank one

  7. 7

    Combining two columns from separate tables into one in SQL Oracle SQL developer

  8. 8

    Merge two columns from two tables into one

  9. 9

    sql query to select just one from the pair

  10. 10

    SQL Server. Join two tables n a view, take rows from one and turn into columns

  11. 11

    sql - how to select multiple columns with only one distinct column from joining multiple tables

  12. 12

    Oracle SQL: Can I combine columns from different tables into one table?

  13. 13

    How can I merge rows and columns from two sql tables into one table

  14. 14

    Prevent Microsoft Word from wrapping tables across columns and pages

  15. 15

    Is it possible to replace the following two SQL selects with just one?

  16. 16

    Is it possible to compare tables from different SQL server?

  17. 17

    SQL IN operator for multiple columns from different tables

  18. 18

    Merging columns from identical tables in SQL

  19. 19

    sql concat columns from different tables

  20. 20

    SQL Pivot from multiple tables and columns

  21. 21

    Get columns from two tables sql

  22. 22

    SQL Stored Procedure - Columns From Three Tables?

  23. 23

    Sql sum() columns from different tables

  24. 24

    QUERYING columns from 3 tables using SQL

  25. 25

    How to prevent automake from overwriting INSTALL?

  26. 26

    Prevent ffmpeg from overwriting existing output file

  27. 27

    Prevent user from overwriting the record CRM 2011

  28. 28

    SQL query from two tables ordering results by both tables columns

  29. 29

    One update SQL query from three tables

HotTag

Archive