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
0
votes
1 answer
Oracle SQL Script - Why spool creates file twice
I run the following SQL-script using Oracle SQL Developer. I don't know why it creates two spool file and it also displays the entire operations in the Oracle SQL Developer console which it should not. Maybe it is due to the SET FEEDBACK ON and SET…

Sherzad
- 405
- 4
- 14
0
votes
1 answer
SCOM OperationsManagerDW table details
I am working on preparing a healthcheck report by pulling the details from OperationsManagerDW database in SCCM server. I need below details to be retrieved from OperationsManagerDW database. Could you please help me with the scripts. I see there is…

Bo_2000
- 7
- 2
0
votes
1 answer
Issue creating consolidated SQL script with multiple ALTER & UPDATES to one table
I am working on a consolidated SQL script that needs to
Add a datetime column named AdjudicatedDateTime to the WarrantyAdjudicationStaging table.
Add a default date of GETDATE() for new entries into the table
Update old records with NULL values of…

Ace
- 1
- 1
0
votes
0 answers
How to include a file with parameters in a SQL script
Given the following SQL script for PostgreSQL...
CREATE TABLE IF NOT EXISTS my_table (
id UUID PRIMARY KEY,
name VARCHAR(255) NOT NULL,
create_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
acl_read …

j3d
- 9,492
- 22
- 88
- 172
0
votes
1 answer
SQL script to make another SQL script
I would need a SQL script that reads the data in the table based on an ID and then generates another SQL script. The generated script should be able to update and insert data previously selected by ID.
I know the update and insert commands, but I…
0
votes
2 answers
How do I select non-deleted records from a history table?
I have a history table table where i keep all the records whether they are inserted, updated or deleted. I want to select only the latest record as per below example.
Example, Below are two transactions 23 and 24. I want to pick the latest update of…

John Bristiw
- 27
- 1
- 1
- 7
0
votes
1 answer
How to update column in one table based on result of select from another table
I need help with script writing for SQL Server 2008.
I have 2 tables, Character and MEMB_INFO, and I want to run this code automatically, as a SQL Server Agent job:
SELECT MasterResetCount
FROM character
WHERE MasterResetCount = 3 OR = 5 OR 7
And…
0
votes
2 answers
How to execute all sql scripts in a Folder using Java?
I want to execute all sql-scripts in one folder via Java. It does not work because earlier it created a new schema (named like the username) and did not take the one written in the sql script. And now i get 44x the Exception showed below. Connection…

Trinity
- 69
- 5
0
votes
0 answers
psql script not working during docarization
Dears,
I have following file structure
-api
-database
-init
-create_database.sql
-dane
-domains.sql
-procedures.sql
-schema.sql
-sequences.sql
-tables.sql
-views.sql
-docker-compose.yml
docker-compose.yml:
version: '3.1'
services:
db:
…

Łukasz Naróg
- 59
- 4
0
votes
0 answers
ExecuteNonQuery" with "0" argument(s): "A transport-level error has occurred when receiving results from the server
While running the SQL script via Powershell Runbook on Azure. I am getting an error :
ExecuteNonQuery" with "0" argument(s): "A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The…
0
votes
2 answers
How to write a SQL Script to Insert/Update Data in table
In SQL Server I have a temporary table called - massupdate and a main table called retaildata
The structure is as follows.
Table massupdate:
| retail_id | Qty|
| 1 | 1 |
| 2 | 2 |
Table retaildata:
| retail_id |…

Sumit Dwivedi
- 21
- 10
0
votes
2 answers
Get Field Hierachy
I have the following tables and I want to get the quantity of users by country:
+--------+------+:
| user | zone |
+--------+------+
| Paul | 7 |
+--------+------+
| John | 5 |
+--------+------+
| Peter | 6 |
+--------+------+
|…

Luis
- 25
- 4
0
votes
1 answer
find a string value 'n/a' in all columns of a table
I would like to search in entire table, where the string is 'NA', 'na' or 'N/A'.
Actually, the value was supposed to be 'n/a' but it was mistakenly placed as 'NA', 'na' or 'N/A' by different department.
I used the following code. But the problem is,…

mumid
- 17
- 2
0
votes
2 answers
Suggestions on How to execute SQL script using VBA in Oracle Database
Here is what I am trying to do:
Pick up SQL script from a worksheet(script has comments and queries)
Assign it to a string variable with the value of range of cells(where the scripts are pasted) from the worksheet
Execute the script by passing the…

siddhant.jain
- 1
- 3
0
votes
1 answer
How can I Execute a SQL statement with one of the paramaters to a variable date?
What I want to do is to let the system date dictate what my reporting year should be in this query:
EXEC [reporting].[Testing]
@CompanyNames = NULL,
@ReportYear = 2020
to something like this:
EXEC [reporting].[Testing]
…

Stapes
- 1