Questions tagged [sql]
150 questions
30
votes
3 answers
vim: Force specific syntax via command-line argument
When I want to easily read my PostgreSQL schema, I dump it to stderr and redirect it to vim:
pg_dump -h localhost -U postgres dog_food --schema-only | vim -
This gives:
vim does not have a syntax highlight schema, because it has no filename…
Adam Matan
- 2,543
- 6
- 29
- 31
17
votes
2 answers
How does this shebang that starts with a double hyphen (--) work?
I have found the following kind of shebang in the RosettaCode page:
--() { :; }; exec db2 -txf "$0"
It works for Db2, and a similar thing for Postgres. However, I do not understand the whole line.
I know the double dash is a comment in SQL, and…
AngocA
- 295
- 1
- 10
8
votes
1 answer
KrbException: Fail to create credential. (63) - No service creds
I am working on setting up Tomcat 8.0.35 on Ubuntu 16.04 with Oracle Java 1.8.0_91-b14 (not openjdk) to use Kerberos authentication when authenticating to our Microsoft SQL database. The issue I am running into is that after running kinit as the…
TimBourne
- 81
- 1
- 3
6
votes
1 answer
dovecot mysql-connection error because of special charater in config
I successful set up my Server with froxlor, etc. but now I get errros with my mail delivery Agent because I use a '#' in my mysql-pw. I tried to escape it with a '\' but it doens't seem to work. :(
How can I change the…
Gamerboy59
- 61
- 1
- 3
5
votes
3 answers
Nice way to SQL query multiple CSV files?
I was looking for a way to traverse CSV files as relational database tables.
I did some research as nothing I found fit my bill of requirements in its entirety. I found several partially good options, namely:
termsql - which takes stdin or a file…
JoséNunoFerreira
- 183
- 1
- 7
4
votes
2 answers
check patterns that don't exist in sqlite
I explained a similar situation with plain text files on Grep huge number of patterns from huge file. Many people there said I should, so now I'm migrating my data to a sqlite database:
I have a file from which I extract about 10,000 patterns. Then…
admirabilis
- 4,642
- 9
- 41
- 57
4
votes
1 answer
An efficient filter for .sql files with just "INSERT INTO"
Several times I've found myself working on data that has been exported to .sql files that I want to process rather than import into a database.
I'm only talking about "pure data" sql files. Ones that have nothing other than INSERT INTO statements.…
hippietrail
- 350
- 1
- 2
- 14
4
votes
2 answers
Replace all occurrences of a character in a variable using korn script
Part of the Korn script I am writing requires that I replace all occurrences of the ' character with two occurrences (''). I am trying to log some SQL that I am generating in this script to a column in another table but single quotes need to be…
Ben
- 205
- 1
- 4
- 6
4
votes
2 answers
Insert to Oracle table in a loop
Requirement: In one server in a directory multiple files are present. I need to read the file names and populate into a Oracle table.
I have written the script like this, but its not working:
#!/bin/bash
names = find /home/devuser -name…
jagan
- 251
- 2
- 3
- 4
3
votes
3 answers
converting insert into to select
I have a file with the following format
INSERT INTO table1(field1,field2,field3) VALUES('values1','value2','value3');
INSERT INTO table1(field1,field2,field3) VALUES('other_values1','other_value2','other_value3');
INSERT INTO…
Emilio Galarraga
- 1,264
- 12
- 19
3
votes
3 answers
Delete multi-line strings
There have been several questions here regarding replacing multi-line strings using the Unix shell, but I haven't found one that will work in this situation.
I am trying to remove keys and constraints from some MySQL DDL, which looks like this (one…
Swechsler
- 43
- 5
3
votes
0 answers
How to Install and run python and database over busybox
I purchased a a WiFi server terminal which runs Busybox and only comes with a http web implementation which pops up once you connect to the WiFi. I'd like to support for SQL (or some variation) and python so i can build in some new web functions…
Xiao Lee
- 31
- 1
- 2
3
votes
2 answers
unexpected EOF while looking for matching `)'
I'm simply trying to get the output from a sql statement and store in bash variable. I am getting " unexpected EOF while looking for matching `)' " error.
I don't see what i'm doing wrong. Why am I getting this error?…
Eternal Punishment
- 31
- 1
- 3
3
votes
1 answer
Change column datatypes in Hive database
Can I change the datatype in Hive database? Below is a complete information about the same.
I have a database named "test". It has a table "name". Below is a query I had used while creating a column in name table.
create table name(custID…
Nitesh B.
- 563
- 2
- 7
- 20
3
votes
4 answers
Tool for escaping all quotes in a string/file
I have a weird problem that I don't have a good way around.
My company, because reasons, stores scripting code in a database table. Don't ask. Whenever I have to insert a new version of the code, I have to go through the file and manually backslash…
Naftuli Kay
- 38,686
- 85
- 220
- 311