Questions tagged [sql]
The sql tag has no usage guidance.
151 questions
-3
votes
1
answer
21
views
For 'a%' why is one of the results that could be returned 'z6ra'?
For 'a%' why is one of the results that could be returned 'z6ra'?
0
votes
2
answers
128
views
Load files in sequential order
I need to load multiple files in my shell script with the same filename but appended in the front of each file name is YYMMDDPERSONNEL
Examples: 231102PERSONNEL and 230103PERSONNEL
There are many ...
-1
votes
1
answer
78
views
Why no one thought of the concept of joins before the 70s? [closed]
So, let me see if I have my history right:
In 1976, the first system sold as an RDBMS was Multics Relational Data Store. I don't know if it had JOIN, but let's assume it did.
The UNIX command join ...
0
votes
0
answers
651
views
Unix : How to convert HTML output from Shell script
How to display the sql query output to HTML table format output.
am having shell script code to display output as html table format. and input is taken form sql query but am not getting the proper ...
0
votes
1
answer
50
views
Sqlite table creation
Is it possible to create tables based on a columns data?
I currently have a table named Exchange which contains numerous columns
ID:NAME:PRICE
1:Stick:12
2:Stone:20
3:Water:1
4:Water:1
But I want to ...
0
votes
2
answers
9k
views
How to write a shell script to run a sql query and send the query results in table format in email?
I need to run a SQL query using SHELL script in PUTTY and send the results in email body in table format with headers along with a message line on top.
I have written this so far but I am not able to ...
0
votes
1
answer
939
views
Cannot install Microsoft SQL Server to Ubuntu AWS /lib/x86_64-linux-gnu/libc.so.6: version 'GLIBC_2.30' not found
I am trying to install SQL server onto a Ubuntu machine on AWS and it has been nothing but trouble. I get stuck on the last step, configuring the server after selecting edition and setting an ...
0
votes
0
answers
131
views
filewatcher script in ksh script
I wanted to edit a already created filewatcher script with the given logic
the source file path is stage path (stage/filewatcherwrap.ksh)
there are 4 files in the below given format in stage path
...
0
votes
1
answer
117
views
why when I execute a select it works and when I execute an update the script blocks?
when I try to execute a query of type update the script hangs and the sql console stays still.
This command executes all queries in the script:
res=$(mysql --defaults-file=conf_file --skip-column-...
0
votes
2
answers
748
views
Slackware and postgres
I want to install postgres and psql via a Slackbuild and I did so. After installing it I tried running the command as suggested in the readme of the Slackbuild but I get an error upon running it as ...
-1
votes
2
answers
150
views
Running SQL databases offline
I'm running a Debian 10 based distro. As an experiment, I downloaded one of these Wikipedia-like sites which gives you a download size of several gigabytes. I was hoping to run it offline.
I don't ...
2
votes
2
answers
2k
views
How to store query multiple result in shell script variable(Array)?
I'm trying to do a query and store every row result in an array element in ksh (maybe bash).
I do:
result=($($PATH_UTI/querysh "
set heading off
set feedback off
SELECT columnA,columnb FROM user....
1
vote
3
answers
176
views
Regular expression - SQL manipulation
[pol@fedora data]$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: Fedora
Description: Fedora release 34 (Thirty Four)
Release: 34
Codename: ThirtyFour
I'm ...
1
vote
1
answer
50
views
whole data isn't showing on POST sql injection
sqlmap -u "http://192.168.0.106/get_method/get_data_login/" --data="name=name&password=pass" -D get_method -T user --dump
Output :
[11:27:40] [INFO] the back-end DBMS is ...
0
votes
1
answer
148
views
not getting whole data by sqlmap
$ sqlmap -u http://192.168.0.106/get_method/get_data/?id=1 -D get_method -T user --dump
But, my data
CSV also completely same as terminal picture
name,serial,password,timestamp
asdf,1,asdf,2021-03-...
0
votes
1
answer
4k
views
using of sqlmap by different ip addresses
sqlmap -u http://192.168.0.106/get_method/get_data/?id=1 --dbs
I know that if we sent any request to any server that server takes ip address of user(mine). So, while I am running the above source ...
0
votes
0
answers
270
views
making sqlcmd self-contained so it would be possible to run without installation, for CentOs
I am trying to make a bash script to connect to remote SQL server with sqlcmd
in the devp machine, as I have admin privileges, runs smoothly
but I NEED (and capitals because it is imperative) to build ...
0
votes
1
answer
63
views
Pass Linux variable in Oracle script
How to pass Linux variable in Oracle code?
I need to pass it in below format and it should not ask for "enter a value for 1:"
Please advise.
mount='/u08/dbname/'
sqlplus -s "/ as sysdba&...
2
votes
2
answers
956
views
Split long SQL expression at delimiter
Context
I'm trying to import a dump that have some long lines (8k+ character) with SQL*Plus, so I face the error SP2-0027: Input is too long (> 2499 characters). This is a hard-coded limit and ...
0
votes
1
answer
102
views
Weird ProFTPd and mod_sql string escaping
I am using/trying to use ProFTPd with users in SQL and using stock sql configuration.
I currently have a problem with weird string escaping, but ONLY for INSERT into the "tally" table, not ...
1
vote
1
answer
3k
views
SQL Server Connection Failed with Linux Mint + SQL Server 2008 R2 using any client
I am trying to connect to my SQL Server 2008 R2 with SP4 database, however, I got this error and I have tried some solutions that I found here, but none works for me.
PS. I do not know exactly how to ...
0
votes
1
answer
134
views
How to create an unprivileged sql database
I need to learn what sql is.
But am too scared of creating a database as root.
This is my current "progress":
$pacman -Syu mariadb # succeeds
$mysql_install_db --basedir=~/.sql/install --...
0
votes
1
answer
1k
views
How to run multiple line sql from text file
a file.txt have a multipe sql update.
update table1 set meta_url = replace(meta_url,'test1.jpg','test1.gif');
update table1 set meta_url = replace(meta_url,'test2.jpg','test2.gif');
update table1 set ...
0
votes
1
answer
1k
views
How to fetch Data of Previous date in shell script?
Kindly refer the script below.
#!/usr/bin/bash
#scirpt to connect with db
master_db_user=''
master_db_passwd=''
master_db_port='3306'
master_db_host=''
master_db_name='uppcldashboard'
Now=$(date +"...
0
votes
1
answer
2k
views
Dynamic date in sql query shell script
Okay kindly refer the below code then I'll put my question.
#!/usr/bin/bash
#scirpt to connect with db
master_db_user='root'
master_db_passwd='123'
master_db_port='3306'
master_db_host='localhost'
...
0
votes
1
answer
2k
views
how to get dynamic variable in a query of a shell script [duplicate]
The last piece of my script is only pending.
kindly refer to the code below.
master_db_user='root'
master_db_passwd='123'
master_db_port='3306'
master_db_host='localhost'
master_db_name='...
0
votes
1
answer
445
views
How do I write SQL to fetch strings that begin with % in Oracle?
Could someone please assist on how to fetch the data in SQL for all the strings starting with %%string?
I tried below to escape %% but it didn't work
SELECT * FROM Tablename WHERE host LIKE ‘[%][%]%’...
0
votes
0
answers
262
views
Convert 2 HTML file which is output from SQL query into 1 main HTML output file in shell script
In shell script, I used 2 different SQL query & output of these 2 files in HTML format like (eg- ab.html, cd.html). Before DML operation 1 SQL query will run then after DML operation another query ...
1
vote
1
answer
1k
views
Convert 2 HTML file output from SQL query into 1 main HTML output file in shell script
In shell script, I used 2 different SQL query & output of these 2 files in HTML format like (eg- ab.html, cd.html). Shell script as ->
#/bin/ksh
ab=$(SQLPLUS -s <username>/<password>@...
1
vote
1
answer
149
views
Failed to find package in third party repository
I'm new to debian & linux, and I want to know how to download packages from third party repositories.
Specifically, I want to download a Microsoft SQL driver into a docker container (guide).
...
0
votes
1
answer
8k
views
How to get result of SQL query in shell script with same format that when we run on Oracle SQL developer/Toad/PLSQL developer
In shell script I am using SQL query.
#/bin/ksh
var=$(sqlplus -s <user>/<password>@DB <<EOF
set heading on
set trimspool off
set linesize 200
set feedback ...
0
votes
2
answers
3k
views
sqlplus doesn't work in Crontab
/oracle/GR1/121/bin/sqlplus / as sysdba <<EOF >> $LOGFILE
whenever sqlerror exit sql.sqlcode;
set echo on;
set serveroutput on;
STARTUP;
EXIT
EOF
Already tried it with the path, but it ...
1
vote
4
answers
5k
views
Shell script to append single quotes and commas
I have a file named input.txt:
$cat input.txt
This is sample
Input file
To execute sql statement
I need output like below assigned to a variable:
X=('This is sample', 'Input file', 'To execute sql ...
0
votes
0
answers
180
views
Extract and combine values from an SQL dump
I have several large SQL dumps with very long lines, including one containing a version & subversion of the database in a long INSERT statement, formatted like this:
INSERT INTO `table` VALUES (.....
0
votes
1
answer
74
views
string substituton for match pattern
I have an SQL file of 170GB. I am trying to restore it on AWS RDS but i am not able because of keyring encryption is enabled on the file. I can't edit it using vi because it's causing my session ...
0
votes
2
answers
3k
views
Sybase query: save output to a file
I´ve created the following script:
#!/bin/bash
isql -U databasename_dba -P password -b <<EOF!
select quantity, date from name_table where numer_id="1234"
go
quit
EOF!
...
0
votes
1
answer
715
views
To print log file with out put of cron job scheduled for a sql block - with Date and time (all the executions of cron)
I have a shell script which executes a pl/sql block, I'm printing output to output file but it's not keeping old information and not displaying time and date when the script was executed.
My script ...
0
votes
1
answer
305
views
How to extract Oracle DML (insert,update) queries from a dump file?
Example:
$cat data.txt
SCN THREAD OPERATION ID OBJECT ID OBJECT NAME REPLICATE OPERATION SQL
------------- ------- ------...
1
vote
1
answer
3k
views
Manjaro MySQL - mariadb.service fails to start
When trying to start MariaDB with systemctl status mariadb, I get:
● mariadb.service - MariaDB 10.3.15 database server
Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor ...
2
votes
3
answers
231
views
Prevent Script from Inserting Space in File Name
I have an Oracle database table that is storing the full path and name of a file in a table column. In a SQL client I can run:
select file_name from table where request_id=12345
and I will get this ...
1
vote
3
answers
677
views
Search for a dynamic pattern in a file in a file and replace it with variables
I have written the below commands that will generate three different shuffled vales
A=`echo 'abcdefghijklmnopqrstuvwxyz' | sed 's/./&\n/g' | shuf | tr -d "\n"`
B=`echo '...
0
votes
1
answer
200
views
Postfix: Whitelist all entries in address book
my postfix currently rejects emails that are potentially SPAM. Howver, some of my contacts have servers that are not correctly configured and I want to avoid rejecting their email.
...
0
votes
1
answer
374
views
Forgot sql password for a certain user (debian)
I have two sql users on my sql server: root and bob. I know the root password, but I forgot bob's password. How can I view/reset bob's password?
-2
votes
2
answers
3k
views
Adding headers to a CSV
I have an SQL command which fetches you an output like
70
138
200
This is stored in a csv and I have added headers to it but appears like
A,B,C
70
138
200
I wanted it to look like
A 70
B 138
C ...
1
vote
1
answer
523
views
PhpMyadmin times out with small SQL file
I am trying to upload bump to phpmyadmin, which has has only 2MB but it has 12 thousand lines.
I always get this error:
Service Unavailable
The server is temporarily unable to service your request ...
3
votes
2
answers
2k
views
Make JSON from SQL query output
I have this database query:
select hostname,size from tableinfo
The output is like this:
hostname size
------------------------- -----------
host1 28
...
1
vote
4
answers
7k
views
SQL operation on csv file using bash or shell
This is my input file
0164318,001449,001452,001922
0164318,001456,001457,001922
0842179,002115,002118,001485
0846354,001512,001513,001590
0841422,001221,001224,001860
0841422,001227,...
17
votes
2
answers
2k
views
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.
...
0
votes
1
answer
592
views
How to compile a ".pc" file on Debian 9?
I need to compile a Pro*C - .pc file on Ubuntu.
So far what I have realised is that I need a Pro*C compiler to translate the Pro*C - .pc file into pure / standard C code.
But I need to have Oracle ...
0
votes
1
answer
1k
views
Use sed to prefix and suffix multiple strings per line
I have a .sql file with some 15,000,000 INSERT commands on each line, which look something like this:
INSERT INTO tableName (col1,col2,col3,col4,col5,col6,col7,col8) VALUES ('Jan 7 2018 12:33PM', 'R'...