SQL Scripts are lists of SQL sentences written in a single file, meant to be executed sequentially. Depending on the particular RDBMS system, SQL scripts can have procedural language characteristics, such as control-of-flow constructs.
Questions tagged [sql-scripts]
437 questions
1
vote
2 answers
How to select rows which have same set of values in two columns and hence concatenate the values in the third column?
Attached Image
I have the sample values as shown in the image attached.
What I want to achieve is that the value of PR_NUMBER field gets concatenated on the basis of same values in PO_NUMBER and PO_ITEM.
Though this is a sample data, any n number of…

Rahul Lamba
- 13
- 3
1
vote
1 answer
How to run a sql script using SQL statements in HyperSQL DB?
I have a .sql file and I need to run it using SQL statement in HSQLDB which is similar to H2's RUNSCRIPT FROM 'abc.sql'

Tarun Maganti
- 3,076
- 2
- 35
- 64
1
vote
0 answers
Inserting lot of records into a table with Tx_id and User_ID where USER_ID is incremented with one,
There is a table with existing records with different entity ids, now need to insert records in the Table using Cursor and without hard coding the records.
Please find my script below.
DECLARE @txId varchar(50)
Declare @UserRole_id int
…

Sandy777
- 41
- 2
- 8
1
vote
2 answers
Is there an easy way to break up a database SQL script file into one file per object?
I have the output of SQL Servers Tasks -> Generate Scripts... for all the tables in my database on one file.
Is there an easy way to break up the single SQL script into one file per table?
Obviously, if I could run the Generate Scripts task with the…

mikemerce
- 3,512
- 1
- 16
- 9
1
vote
1 answer
Regarding SQLl*Plus set statements
I am spooling from a sql script. when sql statement executes the variable substitution it displays it. how can i turn it off. it displays the below along with the csv contents.
old 12: where file_id = '&a_file_id' --1=1
new 12: where file_id =…

Arav
- 4,957
- 23
- 77
- 123
1
vote
1 answer
Generate script for Default Value or Binding in SQL Server
Recently I set value for Default Value or Binding to (newid()) in table design.
Now I want to generate scripts for the changes to execute on another database.
Can anyone please help me to write/generate script for these changes.
Thanks in…

Pedram
- 6,256
- 10
- 65
- 87
1
vote
1 answer
Script to check to Invalid objects in Oracle and build script to compile the invalid objects
In Oracle DB, in some instances the objects (Views/Synonyms) are getting 'Invalid' (Out of compile) which is adding more work to me to maintain these issues frequently.
I'm planning to include some statements in the initial and end of my script in…

SitGeek
- 35
- 1
- 3
- 8
1
vote
1 answer
Initialize a database with a script using Spring JDBC fails
I am trying to initialize my database with a view and a rule following 75.3 Initialize a database using Spring JDBC.
75.3 Initialize a database using Spring JDBC
Spring JDBC has a DataSource initializer feature. Spring Boot enables it by default…

Jagger
- 10,350
- 9
- 51
- 93
1
vote
1 answer
Parallel invocation of SQL script from shell
I am using below logic to execute an SQL in parallel
PID_LIST="start"
while [ "$PID_LIST" ]
do
$count =0
if [ "z$PID_LIST" = "zstart" ]
then
PID_LIST=""
fi
for PID in $PID_LIST
do
# echo "Checkpid $PID"
if kill -0 $PID >/dev/null 2>&1
…

Ashish
- 153
- 1
- 1
- 11
1
vote
0 answers
Execute SQL Script in C# with parameters
I have a method in my C# code that executes an SQL script. If all the values in the script are hard coded, it works fine. But if I try to call a script that uses variables in the form $(varName), I have no idea how to substitute those in my code.…

Arobbins530
- 51
- 7
1
vote
1 answer
Wix MSI installer put garbage character in sql script
I have to create tables inside already existing database While I run my mis package it through error for garbage character which I trace out using sql profiler. How to solve this issue my code is following

zaheer ahmad
- 294
- 4
- 16
1
vote
0 answers
Set SQL alias value
Is there a way to set value of alias isApprover by checking on another column by or e.g. (if the Control.ApproverID or Process.TApprover has a value then set the alias with true value)
Here are the two columns:
cast(case
when…

user2773107
- 55
- 6
1
vote
1 answer
modify encoding for database deploy script
Is there a way to change the encoding for the deploy script generated by Sql Server Data Tools from UTF-8 to ANSI?
The problem that I have is that I have a string in a function that contains the caracter "è" and in the generated deploy script a box…

Buda Gavril
- 21,409
- 40
- 127
- 196
1
vote
1 answer
Using arrays in Oracle scripts
I want to create a script file to INSERT/UPDATE values in to a table. For the sake of maintenance, I want to create an array (multi-dimensional possibly) and loop through it to insert the records. Here are the table columns:
TABLE NAME:…

saz
- 291
- 4
- 16
1
vote
1 answer
Oracle triggers error on sqldeveloper export script
I had built a few tables with sequences and triggers, since I need to share the script with my team at uni I did an export with sqldeveloper, now when I try to import/execute the resulted .sql I'm getting errors with triggers.
This is the error…

stigma
- 338
- 2
- 12