Quoted identifier error Codefluent - codefluent

We have a QUOTEDIDENTIFIER problem with the Azure producer. We have an entity where we defined a Geography property. We created a geospatial index on that table. However, if we perform an insert or update on that table we get the followind error:
INSERT failed because the following SET options have incorrect
settings: ‘QUOTED_IDENTIFIER’. Verify that SET options are correct for
use with indexed views and/or indexes on computed columns and/or
filtered indexes and/or query notifications and/or XML data type
methods and/or spatial index operations.
We solved the error by dropping and restoring all stored procedures of this table but set QUOTED IDENTIFIER ON now.
The problem is, every time we run the producer the stored procedures are dropped and created with QUOTED IDENTIFIER OFF. How can we solve this situation?

You can configure the SQL Server producer to generate set quoted_identifier ON at the top of the files:
<cf:producer name="SQL Server" typeName="CodeFluent.Producers.SqlServer.SqlServerProducer, CodeFluent.Producers.SqlServer">
<cf:configuration quotedIdentifier="ON" ... />
</cf:producer>

Related

View query used in Data Factory Copy Data operation

In Azure Data Factory, I'm doing a pretty vanilla 'Copy Data' operation. One dataset to another.
Can I view the query being used to perform the copy operation? Apparently, it's a syntax error, but I've only used drag-and-drop menus. Here's the error:
ErrorCode=SqlOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=A
database operation failed. Please search error to get more
details.,Source=Microsoft.DataTransfer.ClientLibrary,''Type=System.Data.SqlClient.SqlException,Message=Incorrect
syntax near the keyword 'from'.,Source=.Net SqlClient Data
Provider,SqlErrorNumber=156,Class=15,ErrorCode=-2146232060,State=1,Errors=[{Class=15,Number=156,State=1,Message=Incorrect
syntax near the keyword 'from'.,},],'
Extra context
1.Clear Schema and import Schema again.
2. This mostly happens when there are some changes to table schema after creating pipeline and datasets. verify once.
3.The schema and datasets should be refreshed when there are some changes in the SQL table schema.
4. For table name or view name used in the query, use []. ex: [dbo].[persons]
5. In datasets select table name
6. try to publish before testing.
I followed the same scenario and reproduced the same thing. I didn’t get any error as you can see, the above error mainly happens because of schema.
Source dataset:
In source dataset, I manually added and connected to SQL database with Sample SQL table.
Sink dataset:
In sink dataset, I added another SQL database with auto create table, write behavior: Upset, key column: PersonID.
Before execution there is no table on SQL database, then after the execution was successful, I got this sample output in azure SQL database.

How to rename a table in a database which have referential integrity maintain?

After giving the below command
set integrity for table_name off
I am getting following error
DB2 SQL error: SQLCODE: -290, SQLSTATE: 55039, SQLERRMC: null Message:
Table space access
What could be the possible reason for this?
What I want to achieve is: I want to temporarily disable the constraints so that I can rename the actual table and create a new table with the actual table name. Then i will enable the constraints. Any help of pointers in this regard will be appreciated.
set integrity does not "disable constraints".
As per the SET INTEGRITY statement manual page, set integrity off
Specifies that the tables are placed in set integrity pending state. Only very limited activity is allowed on a table that is in set integrity pending state.
WHen you try to rename a table with constraints you get SQL0750N, which says:
If the error pertains to a RENAME statement, drop the view, materialized query
table, trigger, SQL function, SQL method, check constraint, referential constraint,
expression-based index, or XSR object dependent on the table before issuing the
RENAME statement. Objects dependent on the table can be determined by querying the
catalog.
I.e. you have to drop the constraint, rename the table, then add the constraint back. It is just the way it works. Something like ADMIN_MOVE_TABLE will do the drop and re-create of constraints required, but then that until actually physically moves the table data, so is maybe not a good idea if you simply want to do a rename. Many GUI tolls (such as IBM Data Studio) will generate the required DROP, RENAME, CREATE statements for you.
The error you currently have SQL0290N Table space access is not allowed is a different issue, and will be due to some other cause.

DB2 equivalent for CREATE FORCE VIEW

I am in process of migration MaxDB database to DB2. I need to recreate all views, but their definitions contain references to other views and have the same create date and time, so I'm unable to create them in correct order.
Does the DB2 support somehow the CREATE FORCE VIEW statement?
How can I recreate the views in correct order (without creating SQL parser - because I have just String definition of views from Data Dictionary from MAXDB)?
SELECT for MaxDB:
select vd.*, t.createdate, t.createtime from viewdefs vd
join tables t on vd.viewname = t.tablename and vd.owner = t.owner
order by t.createdate, t.createtime
MaxDB Data Dictionary
You don't indicate what DB2 platform you're using. DB2 for LUW has the database configuration parameter auto_reval, which, when set to deferred (default) or deferred_force, allows you to create dependent objects in any order. With deferred_force in effect objects (including views) that cannot be validated at creation time because of missing dependencies will be created "with error" and revalidated when they are first used in a SQL statement.
You can also explicitly revalidate all invalid objects after you create them by calling the system stored procedure SYSPROC.ADMIN_REVALIDATE_DB_OBJECTS().

How to enforce column order with Liquibase?

Setup:
liquibase 3.3.5
PostgreSQL 9.3
Windows 7 Ultimate
Having set the Liquibase.properties file with
changeLogFile = C://temp/changeset.xml,
I created a diff file with Liquibase (3.3.5).
liquibase.bat diffChangeLog
Examination of the changeset.xml file shows
-<addColumn tableName="view_dx">
<column type="int8" name="counter" defaultValueNumeric="0" defaultValue="0"/>
</addColumn
Problem is when
liquibase.bat update
is run, the changed table is NOT in the same column order as the reference table. This causes issues with the stored procedures using SETOF to return table rows.
Without destroying the existing table on the target database, how can column order be enforced using Liquibase?
TIA
I don't think that you can, in general, get Liquibase to enforce a column ordering. You will probably need to change your stored procedures to use column names rather than relying on position, which is a good habit to get into anyway.
Have you tried using afterColumn attribute of addColumn tag ?

Read-only column mapped using MyBatis Generator

Firebird database supports read-only columns. Columns that have their values computed, not updated. If I map some table with read-only columns using MyBatis Generator I receive the following error while inserting into or updating the table:
org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544359. attempted update of read-only column.
How to treat this kind of column using MyBatis Generator? Is it possible to have insert and update statements ignoring this kind of column?
Note:
Using insertSelective and updateSelective passing the read-only columns values as null, instead of using insert and update, will solve only the cases where I don't want to update other fields to null. So, I need another solution.
MyBatis does not offer additional support to read-only columns. So, the turnaround solution is to set the read only columns with the ignoreColumn tag and to write the queries that need that column value manually, using #Select annotations in mappers.
<table tableName="...">
...
<ignoreColumn column="<read only column>" />
...
</table>