When I run a SQL against one of the tables, this is the value i get against column instruction
<GiftMessage>
<Properties>
<Property Type="FONT">50</Property>
<Property Type="SCRIPT">512</Property>
<Property Type="CARD">B</Property>
<Property Type="FORMATOPTION">N</Property>
<Property Type="WRTIE">D</Property>
</Properties>
<Line SeqNo="1"><![CDATA[]]></Line>
<Line SeqNo="2"><![CDATA[]]></Line>
<Line SeqNo="3"><![CDATA[]]></Line>
<Line SeqNo="4"><![CDATA[ ***712020line2***]]></Line>
</GiftMessage>
How do i grab the value "712020line2" alone from the column to show in my output query using select statement.
Apologize for late reply,
I am connected to Oracle database using Oracle sql developer, and below is the query we run.
select instruction_text,order_no from INSTRUCTION_DETAIL where instruction_text like '%712020%';
Purpose
We used to place around 50-70 orders and share it with different team for shipment, updating each order on what needs to be done is tedious task, so we are planning to update that instruction with "what action the shipment team needs to do", so at the end of
day, we just run this query and download it to excel and share. But the thing is the instruction_text column value comes out in an xml format, so looking for a way to fetch only the instruction text, like in above case, '712020line2', from that xml
Related
I am using XRMToolbox and its tool "Bulk Data Updater" with Microsoft Dynamics CRM. I need to update a boolean value of multiple accounts after searching for them by account number. I believe it requires some type of JOIN.
I believe I have constructed the proper query, but when I try to Bulk Update (see picture), the attribute of the boolean value I need is not listed in the dropdown menu.
When I run this query:
I get the results needed
I get the specific user_id values I need, and I get their status "approved" which is the boolean value I need to change, but I can not edit these values because "approved" attribute is not listed in the dropdown menu
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
<entity name="contact" >
<attribute name="user_id" />
<link-entity name="application" from="applicant" to="contactid" >
<attribute name="approved" />
<link-entity name="contact" from="contactid" to="applicant" >
<filter type="or" >
<condition attribute="user_id" operator="eq" value="0000021" />
<condition attribute="user_id" operator="eq" value="0000055" />
</filter>
</link-entity>
</link-entity>
</entity>
</fetch>
When you want to set fields on an account, you need to query accounts, but you query contacts.
You already chose the XrmToolBox plugin to use for bulk update, but the query is not the expected one to update back the results - i.e., you mentioned account but the query only has contact and application entities joined. So obviously the query is not composed from the right direction.
If you want to update the application entity, build the query in FetchXML builder starting from application entity rather than from related contact side.
Or you can build the Advanced find query to use, (or download the fetchxml from there or even save that Adv.find query as CRM view to use in Bulk Data updater) you can simply export/bulk edit the records in Excel online to save back. You can select 250 records at once to Bulk edit wizard or to run Workflow to update.
Every single approach need the parent entity list from query to update the field. Start over.
I have a number of changesets that I would like to run if a specific condition exists. For example run changesets 1, 2, and 3 only if sqlCheck executed with the excepted results.
I can copy the precondition into each changeset. However it feels like there should be a more efficient way of doing this. As the number of changesets grows, the files have a lot of these duplicates.
The preConditions element directly under databaseChangeLog seems to only configure dbms and runAs.
Is there a way to define a single preCondition that will be used by multiple change sets?
Any help is appreciated.
Unfortunately this is not possible but sometimes you can avoid using preconditions when you declare a property tag instead. For example when you have preconditions for different databases like Oracle and SQL Server which have different data types like
number in Oracle and float in SQL Server, you can instead of using a precondition for each database use a propertytag:
<property dbms="oracle" name="DECIMALTYPE" value="NUMBER" />
<property dbms="mssql" name="DECIMALTYPE" value="FLOAT" />
I'm attempting to load some data into an HSQLDB database using Liquibase 1.9.5. I have a loadData command as follows:
<loadData tableName="LIST_ITEM_TYPE" file="data/global/list_item_type.csv">
<column name="ID" type="NUMERIC" />
<column name="NAME" type="STRING" />
<column name="DESCRIPTION" type="STRING" />
</loadData>
In my CSV data file I'm attempting to set the ID value to the next value from an existing sequence:
id,name,description
next value for SEQ_ITEM_TYPE_ID,Test Name,A test description
However, this doesn't work as it generates the following SQL:
INSERT INTO LIST_ITEM_TYPE (id, description, name) VALUES ('next value for SEQ_ITEM_TYPE_ID', 'A test description', 'Test Name')
This is almost correct, except that the single quotes that Liquibase added around the next value for SEQ_ITEM_TYPE_ID cause HSQLDB to give the following error:
java.sql.SQLException: data exception: invalid character value for cast
If I remove the sinqle quotes and run that SQL manually, it works as expected.
So, my question is, how do I use the Liquibase loadData command pulling data from a CSV file while populating one of the columns from a sequence?
You can achieve this goal by defining a trigger on the target table to use the sequence when the inserted value is a constant that you define. See a related question
Link a sequence with to an identity in hsqldb
Your CSV should probably contain a negative value for the ID column and this should be checked in the trigger WHEN clause.
CREATE TRIGGER trigg BEFORE INSERT ON list_item_type REFERENCING NEW ROW AS newrow FOR EACH ROW WHEN (id < 0) SET newrow.id = NEXT VALUE FOR seq_item_type_id;
Alternatively, insert some sequential numbers in the column using the CSV. After importing the data, use an UPDATE statement to set the values to the seequece. This is practical when the table is not huge. Note the sequential numbers in the insert ensure the insert succeeds if ID is a primary key.
UPDATE list_item_type SET id = NEXT VALUE FOR seq_item_type_id
The third alternative (not using Liquibase) is to create your import file as SQL insert statements rather than CSV. This can be imported into HSQLDB using SQLTool (an HSQLDB utility)
With liquibase 2.0 you may have more options. It may no longer quote the id value if it is defined as number, and/or you can extend the loadData change class to include the SQL.
You can specify that the column is a computed value:
<column name="id" type="computed"/>
this prevents liquibase from putting quotes around the value.
You may be able to use the tag like this:
<modifySql>
<replace
replace="'next value for SEQ_ITEM_TYPE_ID'"
with="next value for SEQ_ITEM_TYPE_ID">
</modifySql>
Solution perfectly worked for me with liquibase 3.2:
<createTable tableName="mytable">
<column autoIncrement="true" name="id" type="BIGINT">
<constraints primaryKey="true" primaryKeyName="mytablePK" />
</column>
...
</createTable>
That definition would create "mytable" table and "mytable_id_seq" sequence as well.
Then, when defining the data in CSV, simply omit the ID column there. Liquibase will do the rest.
Hey Guys,
I'm using nhibernate 2.2 and ran into a problem that I can't seem to find an answer to. My program is using a default schema assigned in the hibernate.cfg.xml file like this:
<property name="default_schema">MY_SCHEMA</property>
which works as advertised for all generated SQL statements, however I have statements in a formula that need to be assigned the default schema as well:
<property name="Count" type="int" formula="SELECT COUNT(*) FROM DETAILS WHERE DETAILS.ID = ID" />
MY_SCHEMA changes relatively often, so I need the SQL to be interpreted as <property name="Count" type="int" formula="SELECT COUNT(*) FROM MY_SCHEMA.DETAILS WHERE DETAILS.ID = ID" />
Is this possible without resorting to hardcoded schemas? Thanks!
Kevin
You can change your mappings on the fly when building the session factory.
Of course that's easier to do if you use a code-based mapping solution, like Fluent or ConfORM.
I'm trying to make NHibernate generate my schema/SQL 2008, and using the mapping below it keeps wanting to create an nvarchar(255) column instead of text...any ideas?
<property name="AnnouncementText" column="AnnouncementText" type="StringClob">
<column name="AnnouncementText" sql-type="NTEXT"/>
</property>
Thanks!
The problem is specifying the name of the column twice...once I took it and the length out of the property element it worked perfectly
<property name="AnnouncementText" type="StringClob">
<column name="AnnouncementText" sql-type="text"/>
</property>
I'm used to SQL Server 2005 and the dialect it uses, but I presume you can do something similar. Since nvarchar(n) allows n up to 4000, a value above this will use nvarchar(max).
I presume that SQL Server 2000, which it sounds like you're using, does something similar once you hit the limit. If I read the NHibernate code correctly (NHibernate.Dialect.MsSql2000Dialect..ctor()) you get ntext once you pass 0xFA0 = 4000 characters.
<property name="AnnouncementText" column="AnnouncementText" type="string" length="10000"/>
this won't help at all, but I remember the good old days ;-)...
create table YourTable
(
...
AnnouncementText text null
...
)