Create multiple databases in ONgDB enterprise - database

Does ONgDB enterprise version support multiple databases? If so how can we create a new database.
I ran the following script
CREATE DATABASE testDB;
Got the error:
Invalid input 't': expected whitespace, comment, '=', node labels, MapLiteral, a parameter, a relationship pattern, ',', LOAD CSV, START, MATCH, UNWIND, MERGE, CREATE, SET, DELETE, REMOVE, FOREACH, WITH, CALL, RETURN, UNION, ';' or end of input (line 1, column 17 (offset: 16))
"CREATE DATABASE testDB"

Related

Loading data from SQL Server to Snowflake using Data Factory is giving error

I have the following table in SQL Server which I am trying to load into Snowflake using Azure Data Factory:
It has 7 columns:
ID, StartDate, Assigner, Priority, Operation, OldValue, NewValue (THIS IS CREATING iSSUE)
NewValue column has double quotes in it might me because of that. Might be its considering one column as multiple columns.. Not sure what is the exact issue.
I am getting following error:
> ErrorCode=UserErrorOdbcOperationFailed,'Type=Microsoft.DataTransfer.Common.Shared.HybridDeliveryException,Message=ERROR [22000] Found character 'C' instead of record delimiter '\r\n'
File '93fcbeba-41f7-4824-b8f6-eda4c2965e00/SnowflakeImportCopyCommand/data_93fcbeba-41f7-4824-b8f6-eda4c2965e00_fa1577fb-8544-44a6-8a60-65bd8b2419c5.txt', line 48, character 39
Row 1 starts at line 2, column "myTable"["$7":7]
Anyone familiar with this error? Guidance is appreciated. Thanks.
See the following link:
https://learn.microsoft.com/en-us/answers/questions/559372/delimiter-error-in-copy-actibity-of-adf.html
From that reference:
The issue could be because of the first stage (Source -> staging blob) use csv format and the format serializer failed to escape the escape char in the data eventually causing the data to be invalid.
You could try the below workaround at your end.
Manually edit JSON payload of your pipeline, go to properties -> activities -> {your copy activity} -> "typeProperties", add a flag "escapeQuoteEscaping": true

SSMS Generates insert scripts that don't work

I use SSMS to generate scripts from a database. These scripts are just data scripts (not schema)
When I use these scripts to insert data into an empty copy of this database, I get this error:
Msg 105, Level 15, State 1, Line 27
Unclosed quotation mark after the character string ''.
Msg 102, Level 15, State 1, Line 27
Incorrect syntax near ''.
And no rows are inserted.
Initially I thought the line returns were killing it but this isn't the case. I can insert individual rows with no issue (select individual "insert" statements and run those okay). The line numbers aren't really useful either.
How can I make my insert script work? This is on SQL Server 2017. I would have thought that as the script is a thousands of "INSERT" statements, it would insert the statements that work and skip the ones that didn't (show an error for those insert statements)
EDIT: I can't post the insert statement because it's a work thing. I know that makes this difficult to troubleshoot. I just noticed something else though.
If I copy the entire insert statement to notepad, it truncates at a weird place in the paste. As in, it doesn't paste the entire line in.
In SSMS the value to be inserted looks like this:
But if I copy paste that field out just by itself, I get this: , N'. The paste ends just before the "whitespace" character.
It seems like the whitespace character isn't printable, and that's what is causing the insert to fail.

Pentaho insert operation error due to a collation

I have a Pentaho transformation which executes a procedure from a database and then insert the rows into another database.
The source database is a sql server 2008 r2 database, not utf8 charset, Latin_general_ci, and the destiny databanase is postgresql with utf8 charset.
If I execute the ETL it throws an error when attempt to insert the following statement:
INSERT INTO aux (name, account, id, state) VALUES ( 'UAN 5 BAR ','01082082R','UY903847JDNF','BAJA')
As you can see in the name value field exists some unknown characters. Pentaho shows that with some square images,exactly 6. If I copy the insert statement from log the row is break in this point so I understant that it is a break of line or something like that.
I solved this for other rows, that the hidden chars are different, but in this case I can not solve this. Furthermore I would like to find a solution to solve all the possible problems of charset.
Anyone knows how to solve that?
In the other hidden char I solved it applying cast(name as binary) but this does not workd for this other case.
EDIT
The value 'UAN 5 BAR ' has unknown chars just after the word BAR until the quote char '.
When I say unknown means weird chars that I can not see what they are.

Why SQL Server doesn't treat this code erratic? [duplicate]

Shouldn't one of these statements work and one fail?
Intuition says Statement 2 should fail because there is a comma after int and no second column listed.
Yet both work and the trailing comma "," after the last column data type makes no difference.
-- Statement 1
CREATE TABLE dbo.MyTable1( col1 int);
-- Statement 2
CREATE TABLE dbo.MyTable2( col1 int,);
However (and this is expected): two commas ",," after the last field do cause a failure:
-- Statement 3
CREATE TABLE dbo.MyTable3( col1 int,,);
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.
Testing shows that its not just any character after the last field that is allowed through. For example, this fails:
-- Statement 3
CREATE TABLE dbo.MyTable3( col1 int ~);
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near '~'.
Maybe SQL Server is "saving a seat at the table" for something? The Primary Key perhaps? I really don't know.
I am using Microsoft SQL Server 2008 R2 (SP1) - 10.50.2500.0 (X64).
See http://connect.microsoft.com/SQLServer/feedback/details/273348/trailing-comma-allowed-in-create-table:
Description
When executing the CREATE TABLE command, a trailing comma following
the last column is allowed. Based on the grammar in BOL and comma
usage in lists in other T-SQL statements, this behavior is
inconsistent. This is a very minor issue and does not appear to cause
any adverse side-effects. It just appears that the parser may be a bit
off.
Microsoft views this as a bug, but a minor one.
This was resolved some time ago as "won't fix" but we didn't explain why. Simply, this seems pretty harmless, and not worth fixing in a service pack. We may consider fixing this in a future release.
It should be flagged as a syntax error, but there is a bug in SQL Server that doesn't treat the trailing comma as a syntax error.
Source: Microsoft Support (The affected versions in the list - 6, 6.5, and 2000 - are old, but I guess it's still around because it just worked for me in 2008.)
Almost all languages which permit comma-separated list items permit a comma after the last list item. This is done to make editing the program or file, and especially inserting new list items, easier. You don't have to worry about adding a comma after the current last list item, or removing a comma if you delete the old last list item.

How to search for a string in the whole database?

I have an informix database consisting of a large number of tables.
I know that there is a string "example" somewhere inside some table, but don't know which table it is or which column it is. (I know this is a very rare case)
Because of the large number of tables, there is no way to look for it manually. How do i find this value inside this large database? Is there any query to find it?
Thanks in advance!
Generally, you have two approaches.
One way would be to dump each table to individual text files and grep the files. This can be done manually on a small database, or via a script in the case of a larger one. Look into UNLOAD and dbaccess. Example in a BASH script: (you'll need to generate the table list in the script either statically or via a query.)
unload_tables () {
for table in ${TABLE_LIST} do
dbaccess database_name << EOF
unload to "${OUT_PATH}/${table}/.out"
select * from $table;
EOF
done
}
Or, this is a little more complicated. You can create a specific SELECT (filtering each column by "example") for each table and column in your db in a similar automated fashion using systables and syscolumns, then run each sql.
For example, this query shows you all columns in all tables:
SELECT tabname, colno, colname, coltype, collength
FROM systables a, syscolumns b
WHERE a.tabid = b.tabid
It is easy to adapt this such that the SELECT return a proper formatted SQL string that allows you to query the database for matches to "example". Sorry, I don't have a full solution at the ready, but if you google for "informix systables syscolumns", you will see lots of ways this information can be used.
In Informix, determining the columns that contain character data is fiddly, but doable. Fortunately, you're unlikely to be using the esoteric features such as DISTINCT TYPE that would make the search harder. (Alphadogg's suggestion of unload - using dbexport as I note in my comment to his answer - makes sense, especially if the text might appear in a CLOB or TEXT field.) You need to know that types CHAR, NCHAR, VARCHAR, NVARCHAR, and LVARCHAR have type numbers of 0, 13, 15, 16 and 43. Further, if the column is NOT NULL, 256 is added to the number. Hence, the character data columns in the database are found via this query:
SELECT t.owner, t.tabname, c.colname, t.tabid, c.colno
FROM "informix".systables t, "informix".syscolumns c
WHERE t.tabid = c.tabid
AND c.coltype IN (0, 13, 15, 16, 43, 256, 269, 271, 272, 299)
AND t.tabtype = 'T' -- exclude views, synonyms, etc.
AND t.tabid >= 100 -- exclude the system catalog
ORDER BY t.owner, t.tabname, c.colno;
This generates the list of places to search. You could get fancy and have the SELECT generate a string suitable for resubmission as a query - that's left as an exercise for the reader.

Resources