The meaning of $> inside the CDATA block.I am trying to understand the part inside the CDATA block of an XML code file,the parts where $> is used.What is the use of it?
<sqlTask name='LOGIN_USER'>
<![CDATA[
SELECT owner_id $>REGISTRAR_PK, SYSDATE $>TIMESTAMP, ops\$rs3.report_seq.nextval $>REPORT_ID
FROM ops\$rs3.smdi_owners
WHERE user_name = UPPER($LOGIN_USER)
]]>
<error text='Registrar: $LOGIN_USER - Unknown user.'/>
</sqlTask>
Related
I am trying to place sql query to read data from kudud table in applciation.yaml file where string literal is used.
But while running the program it is giving the parsing error as below -
EL1043E: Unexpected token. Expected 'rcurly(})' but was 'identifier'
Below is the query used where "FINNACE" is a literal-
application.yaml -
filequery.map : '{
"filequery" : "SELECT FILE,
project
FROM
( SELECT FILE AS file_or_table_group,
"FINNACE" AS project
FROM finnance_data ) AS finnancedata"
}'
I have a change log file,part of which looks like:
<include file="ChangeSets/00_SessionAuth.xml"/>
<include file="ChangeSets/01_Legacy_Baseline_V197_ANB.xml" context="legacy"/>
<include file="ChangeSets/02_V198_ANB.xml" context="non-legacy"/>
The change set 01_Legacy_Baseline_V197_ANB.xml has 197 sql scripts included,which are part of legacy database.
The change set 02_V198_ANB.xml is defined as:
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.5.xsd
http://www.liquibase.org/xml/ns/dbchangelog-ext
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd">
<include file="ChangeSets/sql/Dummy_schema/V198_AddColumn.sql"/>
</databaseChangeLog>
When i run the Liquibase update with context as non legacy, i get the following error :
Unexpected error running Liquibase: DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=SET SCEHMA = Dummy_schema;;BEGIN-OF-STATEMENT;<space>, DRIVER=3.62.56 [Failed SQL: SET SCEHMA = Dummy_schema;
The SQL file itself is correct.
I think this is an issue related to end delimiter or splitStatements.
The SQL goes like this:
SET SCEHMA = Dummy_schema;
ALTER TABLE T1 ADD COLUMN C1 VARCHAR(35)
ADD COLUMN C2 INTEGER;
Call Sysproc.admin_cmd ('REORG TABLE dummy_schema.T1');
ALTER TABLE T2 ADD COLUMN CT1 INTEGER;
Call Sysproc.admin_cmd ('REORG TABLE dummy_schema.T2');
We are using DB2 V10.5.
Can someone also provide the list of attributes,we can use with tag.
Regards
I think your assertion that
the SQL file itself is correct
is incorrect. That is valid SQL if it was run through the db2 command line application, but it is not valid SQL to be sent through a JDBC query, which is what Liquibase does.
I want to add some data only on development database for test purposes.
To do so, I created a test_data.sql that is included using
<include file="./test_data.sql" relativeToChangelogFile="true"/>
The test_data.sql is formatted as follows:
--liquibase formatted sql
--changeset whiad-16453:testdata runOnChange:true failOnError:true endDelimiter:go stripComments:false
--preconditions onFail:HALT onError:HALT
--precondition-sql-check expectedResult:1 select case when db_name()='devdb' then 1 else 0 end
insert into...
I expected that the insert is only performed, when the select returns 1 (it is a Sybase SQL dialect and I executed the query both on Dev and Prod environment using Sybase Central and it return 0 or 1 as expected).
Nevertheless, Liquibase created a script including the inserts (using updateSQL commandline argument).
I alternatively tried to use the precondition right before the include file in the changelog:
<preConditions>
<sqlCheck expectedResult="1">select case when db_name()='devdb' then 1 else 0 end</sqlCheck>
</preConditions>
<include file="./test_data.sql" relativeToChangelogFile="true"/>
But also in this case the insert where perfomed.
I also tried to used a property that i use in the condition:
<changeLogPropertyDefined property="deploy_test_data" value="true"/>
But this also didn't had any effect.
What do I do wrong?
I used now the context for my purpose passing "contexts==!testdata" as parameter on prod.
i want to print xml header with xmldom. The problem is, it prints only the xml version but missing the encode information.
What i got :
<?xml version="1.0"?>
What i want:
<?xml version="1.0" encoding="UTF-8"?>
im using ORACLE 11g
And here is what i got so far:
doc := xmldom.newdomdocument;
xmldom.setversion(doc,'1.0');
xmldom.setCharset(doc,'UTF-8');
mainNode := xmldom.makeNode(doc);
rootElmt := xmldom.createElement(doc,'Dokument');
rootNode := xmldom.appendChild (mainNode,xmldom.makeNode(rootElmt));
SetCurNode (rootNode);
dbms_lob.createTemporary(vClob,true);
dbms_xmldom.writeToClob (doc,vClob);
xmldom.freedocument (doc);
Thanks in advance,
Ivan
Not entirely sure why charset isn't included in the output, but it seems to be a common issue. One alternative (shown here: https://asktom.oracle.com/pls/apex/f?p=100:11:0::::P11_QUESTION_ID:2791321000346652231) is to do the following:
xmldom.setVersion(doc,'1.0" encoding="UTF-8');
Edit: Apparently, the character set you specify is ignored unless you use the writeToFile procedure, this would explain why it is not being included in the output when using writeToClob
I have to load several tables into SQL Server 2012 from SQL Server 2000. I heard BIDS could do this and I'm pretty new to it and wanted to some help. I would really appreciate whatever help I get with it.
I have Installed BIDS helper. already and used the below code. But it gives me errors stating,
Error 1187 Illegal syntax. Expecting valid start name character.
Error 1188 Character '#', hexadecimal value 0x23 is illegal in an XML name.
Error 1189 The character '#', hexadecimal value 0x40 is illegal at the beginning of an XML name.
<## template language="C#" hostspecific="true" #>
<## import namespace="System.Data" #>
<## import namespace="System.Data.SqlClient" #>
<## import namespace="System.IO" #>
<Biml xmlns="http://schemas.varigence.com/biml.xsd">
<!--
<#
string connectionStringSource = #"Server=xxxxx;Initial Catalog=xxxx;Integrated Security=SSPI;Provider=sqloledb";
string connectionStringDestination = #"Server=xxxxxx;Initial Catalog=xxxxxxx;Integrated Security=SSPI;Provider=SQLNCLI11.1";
string SrcTableQuery = #"
SELECT
SCHEMA_NAME(t.schema_id) AS schemaName
, T.name AS tableName
FROM
sys.tables AS T
WHERE
T.is_ms_shipped = 0
AND T.name <> 'sysdiagrams';
";
DataTable dt = null;
dt = ExternalDataAccess.GetDataTable(connectionStringSource, SrcTableQuery);
#>
-->
<Connections>
<OleDbConnection
Name="SRC"
CreateInProject="false"
ConnectionString="<#=connectionStringSource#>"
RetainSameConnection="false">
</OleDbConnection>
<OleDbConnection
Name="DST"
CreateInProject="false"
ConnectionString="<#=connectionStringDestination#>"
RetainSameConnection="false">
</OleDbConnection>
</Connections>
<Packages>
<# foreach (DataRow dr in dt.Rows) { #>
<Package ConstraintMode="Linear"
Name="<#=dr[1].ToString()#>"
>
<Variables>
<Variable Name="SchemaName" DataType="String"><#=dr[0].ToString()#></Variable>
<Variable Name="TableName" DataType="String"><#=dr[1].ToString()#></Variable>
<Variable Name="QualifiedTableSchema"
DataType="String"
EvaluateAsExpression="true">"[" + #[User::SchemaName] + "].[" + #[User::TableName] + "]"</Variable>
</Variables>
<Tasks>
<Dataflow
Name="DFT"
>
<Transformations>
<OleDbSource
Name="OLE_SRC <#=dr[0].ToString()#>_<#=dr[1].ToString()#>"
ConnectionName="SRC"
>
<TableFromVariableInput VariableName="User.QualifiedTableSchema"/>
</OleDbSource>
<OleDbDestination
Name="OLE_DST <#=dr[0].ToString()#>_<#=dr[1].ToString()#>"
ConnectionName="DST"
KeepIdentity="true"
TableLock="true"
UseFastLoadIfAvailable="true"
KeepNulls="true"
>
<TableFromVariableOutput VariableName="User.QualifiedTableSchema" />
</OleDbDestination>
</Transformations>
</Dataflow>
</Tasks>
</Package>
<# } #>
</Packages>
</Biml>
This is the maddening thing about trying to do much BimlScript in Visual Studio. The editor "knows" it's doing XML markup so all of the enhancements that make up BimlScript are "wrong" and so it's going to highlight them and put angry red squigglies and have you question whether you really have valid code here.
In my Error List, I see the same things you're seeing but this is one of the few times you can ignore Visual Studio's built in error checker.
Instead, the true test of whether the code is good is right click on the .biml file(s) and select "Check Biml for errors"
You should get a dialogue like
If so, click Generate SSIS Packages and then get some tape to attach your mind back into your head as it's just been blown ;)
Operational note
Note that the supplied code is going to copy all of the data from the source to the target. But, you've also specified that this is going to be a monthly operation so you'd either want to add a truncate step via an Execute SQL Task, or factor in a Lookup Transformation (or two) to determine new versus existing data and change detection.