SQL Workbench/J WbDataDiff TimeStampt - sql-workbench-j

I'm executing data diff command in SQL-Workbench/J to compare two PostgreSQL 10 tables. As following
WbDataDiff -referenceProfile="prod"
-targetProfile="dev"
-referenceTables=public."Product"
-file=migrate_staging.sql
-includeDelete=false
-sqlDateLiterals="ansi"
But the SQL output of the command is not compatible with the SQL. Notice in the following example Timestamp should have been like '2020-07-14T16:00:48.918167' with no spaces and with single quotes. I've tried "ansi", "dbms" and "default" for the parameter sqlDateLiterals, but the output was the same.
UPDATE "Product"
SET "UpdateDate" = 2020 -07 -14 T16:00:48.918167
WHERE "OID" = 11109;
So how can I output the proper Timestamp format using this command?

Turns out this was a bug that has been fixed in the dev build as of 15/07/2020

Related

On IBM i, how to run a stored procedure via DB2 command of QShell?

How would you run a stored procedure via DB2 command of QShell, as I need a simple way to unit test a change to a stored procedure?
On IBM i
Started qshell with
QSH
Entered these db2 commands in various formats without success
db2 call libraryname.stroredprocedurename('param1value' 'param2value' ?)
db2 call libraryname.stroredprocedurename ('param1value' 'param2value' ?)
db2 call libraryname.stroredprocedurename (param1value param2value ?)
Only reference source I could find
Have tried using CLP to call stored proceduresbut there are no CLP examples
here
You can also use the JDBC client included with jt400.jar. You can run it from QSH by using the following command.
java -cp /qibm/proddata/os400/jt400/lib/jt400.jar com.ibm.as400.access.jdbcClient.Main jdbc:db2:localhost
The client will also handle stored procedure output parameters as shown by the following example.
create procedure add1(in inparm int, out outparm int) language sql begin set outparm = inparm +1; end
call add1(1,?)
Parameter 1 returned 2
I use Squirrel SQL Client http://squirrel-sql.sourceforge.net/ to test all of my SQL.
call libraryname.stroredprocedurename('param1value', 'param2value')
Note the separator is a comma ,, and ? is not a valid parameter marker when called interactively like this.
In addition to the client, you will need a JDBC driver. You can use the JTOpen driver for IBM i found here: http://jt400.sourceforge.net/
From the CL command line, or inside a CL program, you can use the RUNSQL command to execute an SQL statement.
If you're going to be trying multiple ad hoc SQL statements, you might use the STRSQL command. Personally, I tend to use the SQL window provided as part iNavigator.
Finally got the basic syntax
db2 "CALL lib.proc ('parmvalue1')"
Which resulted in:
DB20000I THE SQL COMMAND COMPLETED SUCCESSFULLY.

Serious issue from production convert from string to decimal issue

actually I have developed a web application in MVC 5.0 with Entity framework 6.0, sql server ..
I tried to query a sum value which is Amount(Float in sql server)
SearchDetails.Sum(total => Convert.ToDecimal(total.Amount));
getting
input string was not in a correct format
I took database backup and I tried to run from my side I am getting the value
I have verified in the database all the values are in correct format
I tried to print the values
total.Amount
getting a comma
","
instead of dot
"."
in my PC value is like 300.00 but the same in client PC getting 300,00 ?
Please help.
I have Add this in
in globlization section SET culture = en-US
this solved my issue
Thanks

How can I force Liquibase to recalculate checksums without re-running the statements?

We're using Liquibase 3.2 with Java 6. Is there a way I can force Liquibase to recalculate checksums without re-running the same statements from our Liquibase files? In our database, I run this ...
update DATABASECHANGELOG set md5sum = null where 1;
However, when I run my Liquibase change scripts, certain executions still fail with the following errors ...
invoking liquibase change script with file /tmp/deploywork/db.changelog-master.xml
running /usr/java/liquibase/liquibase --logLevel=info --driver=com.mysql.jdbc.Driver --classpath=/usr/java/jboss/modules/com/mysql/main/mysql-connector-java-5.1.22-bin.jar --changeLogFile=/tmp/deploywork/db.changelog-master.xml --url="jdbc:mysql://myservername:3306/my_db" --username=username --password=password update
INFO 5/13/15 2:15 PM: liquibase: Successfully acquired change log lock
INFO 5/13/15 2:15 PM: liquibase: Reading from my_db.DATABASECHANGELOG
INFO 5/13/15 2:15 PM: liquibase: Successfully released change log lock
Unexpected error running Liquibase: Validation Failed:
3 change sets check sum
db.changelog-1.0.xml::1357593229391-25::rob (generated) is now: 7:5cfe9ecd779a71b6287ef2360a6979bf
db.changelog-7.0.xml::create-address-email-index::davea is now: 7:da0132e30ebd6a1bc52d9a39bb8c56d7
db.changelog-7.0.xml::add-myproject-event-object-id-col::davea is now: 7:2eab5d784647ce33ef3488aa8c383443
SEVERE 5/13/15 2:15 PM: liquibase: Validation Failed:
3 change sets check sum
db.changelog-1.0.xml::1357593229391-25::rob (generated) is now: 7:5cfe9ecd779a71b6287ef2360a6979bf
db.changelog-7.0.xml::create-address-email-index::davea is now: 7:da0132e30ebd6a1bc52d9a39bb8c56d7
db.changelog-7.0.xml::add-myproject-event-object-id-col::davea is now: 7:2eab5d784647ce33ef3488aa8c383443
liquibase.exception.ValidationFailedException: Validation Failed:
3 change sets check sum
db.changelog-1.0.xml::1357593229391-25::rob (generated) is now: 7:5cfe9ecd779a71b6287ef2360a6979bf
db.changelog-7.0.xml::create-address-email-index::davea is now: 7:da0132e30ebd6a1bc52d9a39bb8c56d7
db.changelog-7.0.xml::add-myproject-event-object-id-col::davea is now: 7:2eab5d784647ce33ef3488aa8c383443
at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:181)
at liquibase.Liquibase.update(Liquibase.java:191)
at liquibase.Liquibase.update(Liquibase.java:174)
at liquibase.integration.commandline.Main.doMigration(Main.java:997)
at liquibase.integration.commandline.Main.run(Main.java:170)
at liquibase.integration.commandline.Main.main(Main.java:89)
Here is one of the change sets that the script is complaining about …
<changeSet author="davea" id="add-myproject-event-object-id-col">
<addColumn tableName="sb_myproject_event">
<column name="OBJECT_ID" type="VARCHAR(32)"/>
</addColumn>
<createIndex indexName="SB_myproject_EVENT_IDX"
tableName="sb_myproject_event"
unique="false">
<column name="OBJECT_ID" type="varchar(32)" />
</createIndex>
<sql>update sb_myproject_event set object_id=LEFT(SUBSTRING_INDEX(event_data, '"id":"', -2), 24) where object_id is null and event_data is not null;</sql>
<!-- Delete older events that no longer need to be processed -->
<sql>delete from sb_myproject_event where id not in (select q.* from (select e.id FROM sb_myproject_event e, (select object_id, max(date_processed) d from sb_myproject_event group by object_id) o where e.object_id = o.object_id and e.date_processed = o.d) q);</sql>
</changeSet>
As I said, I only want to recalculate checksums (have to do this because we're changing Liquibase versions).
Rather than clearing the checksums yourself using SQL, it will probably be better to let Liquibase do that by using the clearCheckSums command:
https://docs.liquibase.com/commands/community/clearchecksums.html
Removes current checksums from database. On next run checksums will be recomputed.
Use the command below if you are using maven:
mvn liquibase:clearCheckSums
For those interested in what liquisebase:clearCheckSums does is it basically runs this sql
UPDATE databasechangelog SET MD5SUM = NULL
Alternatively, you can truncate the 'databasechangelog' table; the new changelog entries will be inserted the next time liquibase is run.
If you are using jHipster they fixed this behavior in v7.x so that liquibase knows to re-compute check sums. (This is if you are getting the error related to failed check sum validations and you are sure the changelog entries you have are correct).

How to specify a value for a Jenkins environment variable that contains a space

I am trying to specify a value for a Jenkins environment variable (as created on the Manage Jenkins -> Configure System screen, under the heading "Global properties") which contains a space. I want to use this environment variable in an Execute Shell build step. The option that I need to appear in the command line in the build step is:
--platform="Windows 7"
The syntax I am using on the command line is --platform=${VARIABLE_NAME}
No matter how I attempt to format it, Jenkins seems to reformat it so that it is treated as two values. I have tried:
Windows 7
"Windows 7"
'Windows 7'
Windows\ 7
The corresponding results, when output during the Execute Shell build step have been:
--platform=Windows 7
'--platform="Windows' '7"'
'--platform='\''Windows' '7'\'''
--platform=Windows/ 7
I have also tried changing my command line syntax to --platform='${VARIABLE_NAME}' as well as '--platform=${VARIABLE_NAME}', but in each of those cases the ${VARIABLE_NAME} is not resolved at all and just appears as ${VARIABLE_NAME} on the resulting command.
I am hoping there is a way to make this work. Any suggestions are most appreciated.
You should be able to use spaces without any special characters in the global properties section.
For example, I set a variable "THIS_VAL" to have the value "HAS SPACES".
My test build job was the following:
#!/bin/bash
set +v
echo ${THIS_VAL}
echo "${THIS_VAL}"
echo $THIS_VAL
and the output was
[workspace] $ /bin/bash /tmp/hudson8126983335734936805.sh
HAS SPACES
HAS SPACES
HAS SPACES
Finished: SUCCESS
I think what you need to do is use the following:
--platform="${VARIABLE_NAME}"
NOTE: Use double quotes, not single quotes. Using single quotes makes the stuff inside the quotes literal, meaning that any variables will be printed as is, not parsed into the actual value. Therefore '${VARIABLE_NAME}' will be printed as is, not parsed into "Windows 7".
EDIT:
Based on #BobSilverberg comment below, use the following:
--platform="$VARIABLE_NAME"
Note: no curly brackets.

Why is SQL CE Toolbox failing to parse my csv file?

SQLCEToolbox looks very promising.
I installed it, opened VS 2012, selected Tools | SQL Server Compact Toolbox, quickly and easily set up a connection to my sdf database, which I had (also quickly and easily) created in WebMatrix.
I then right-clicked the database in SQLCEToolbox's treeview and selected Import from CSV file.
Note: One must explicitly specify the column names on the first line in the file (line/row 0) and explicitly add the ID/Primary Key/Identity vals (if you have such a column).
Once I fixed the various formatting errors with my csv file, it seemed to import well. But I got this err msg:
Error Code: 80004005
Message : The data was truncated while converting from one data type to another. [ Name of function(if known) = ]
Minor Err.: 25920
Source : SQL Server Compact ADO.NET Data Provider
My data is in the format:
1,SomeCategory,SomeName,SomeURL,Longitude,Latitude
As an example, here's a sample line:
3,ArtGallery, Henry Miller Memorial Library,http://www.henrymiller.org/, -121.7537834,36.2207945
Except for the int ID column, they are all nvarchar(50) columns. So I realized that some of my URLs were longer than 50 chars; so, in WebMatrix, I modified that column to be nvarchar(128). On trying again to import, apparently that first problem was solved, but now I get:
Error Code: 80004005
Message : The column cannot be modified. [ Column name = ID ]
Minor Err.: 25004
Source : SQL Server Compact ADO.NET Data Provider
Err. Par. : ID
Okay, I reason, since the ID column is to be automatically updated, I shouldn't have it in my csv file. So I changed it to this:
Category,Name,URL,Longitude,Latitude
ArtGallery, Henry Miller Memorial Library,http://www.henrymiller.org/, -121.7537834,36.2207945
...but when I tried importing the records that way (with "ID" removed from row 0 and the corresponding val from each line/record), and try to import, I get:
Error Code: 80004005
Message : The data was truncated while converting from one data type to another. [ Name of function(if known) = ]
Minor Err.: 25920
Source : SQL Server Compact ADO.NET Data Provider
I tried to post a question at http://sqlcetoolbox.codeplex.com/, but trying to do so simply took me to a generic codeplex area (rather than a SQL CE Toolbox-specific area).
So what might be the problem here (the revised row 0 and another sample row are shown below) now? The longest URL is only 98 chars.
What's wrong with my data or methodology?

Resources