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
Serial loop number add PostgreSQL
I need insert into my PostgreSQL database , please help me for wrote script for this script
INSERT INTO accounts (serial, active, name)
VALUES (111100000000, true, 111100000000);
****Start Number 111100000000****
End Number 111199999999
anyone can…

Mr Kazemi
- 55
- 1
- 10
0
votes
1 answer
SQL script kill jsp render
I have a web application that save sql scripts. This with the help of spring
The form is filled, it is saved and the response is returned on the same form
This is the form
…

jasilva
- 730
- 3
- 17
- 45
0
votes
1 answer
how to get xsd element format result from sql script
I need to create xml files to migrate a huge amount of data from one database to another database.
How to get result xsd format as below from ms sql script query?
Please share if you have any idea.
The xml file format is below:
…

Tun
- 824
- 3
- 16
- 30
0
votes
2 answers
Can I update a particular attribute of a tuple with the same attribute of another tuple of same table? If possible what should be the algorithm?
Suppose I have a table with 10 records/tuples. Now I want to update an attribute of 6th record with the same attribute of 1st record, 2nd-7th, 3rd-8th, 4th-9th, 5th-10th in a go i.e. without using cursor/loop. Use of any number of temporary table is…

Shahid
- 21
- 4
0
votes
1 answer
Sql script generated by management studio gives errors when run as query
I have a huge database. I got script of my database schema using sql server management studio.
Script contains 176,000 lines. When I copied script to new query window and executed it. It says
1. Incorrect syntax near 'GO' => This error repeats after…

Sami
- 8,168
- 9
- 66
- 99
0
votes
1 answer
JPA 2.1 Drop Script execution from persistence.xml with Arquillian & Shrinkwrap
I'm writing some Arquillian (with Shrinkwrap) tests, and im currently using the JPA 2.1 create and drop automation with scripts, via persistence.xml:
// src/test/resources-wildfly-remote/test-persistence.xml
// runs fine, configured as resource in…

vcorrea
- 101
- 2
- 8
0
votes
1 answer
SQL Script: Updating a column with another table pivoting on an ID
I have two SQL Server tables: ORDERS and DELIVERIES.
I would like to update the ORDERS table with a value from DELIVERIES. The ORDERS PK (OrderID) is common to both tables. Also, I would like to restrict the action to a specific CustomerID (within…

Jamie McRobb
- 1
- 1
0
votes
1 answer
Move tables between two SQL Server databases using C#
Now this question may have been asked before but none of the answers I've found are satisfactory. Simply what I'm trying to do is move one table (including data) between databases under one instance of SQL Server Express.
I have tried creating a…

barnacle.m
- 2,070
- 3
- 38
- 82
0
votes
0 answers
Nested while loop in tsql script
I am trying to write a sql script that inserts 1000 rows into the table but increments the day every 1000 rows.
this is what I have so far:
DECLARE @StartDate Date = GetDate();
DECLARE @EndDate Date = DATEADD(yy, DATEDIFF(yy,0,getdate()) + 1, -1)…

Zapnologica
- 22,170
- 44
- 158
- 253
0
votes
1 answer
How to add month field in select statement in SQL Server 2012?
My code is:
create table t_AccountTransactions
(
CompanyID varchar(50) ,
RecordID int ,
Branch varchar(100) ,
Year int,
Month varchar(2),
Date_Gregorian date,
Date_Persian varchar(100),
VoucherType varchar(100),
…

Arash
- 1,692
- 5
- 21
- 36
0
votes
1 answer
Global variable in oracle
In Sql developer I need to store the variable and use it later how to do that?
VARIABLE liab NUMBER;
exec select nvl(LIAB_ID,-1)into liab FROM GETM_LIAB_CUST WHERE CUSTOMER_NO = (select customer_id from apps_master where ACCOUNT_NUMBER='&C'…

user3737084
- 7
- 8
0
votes
1 answer
Condition based spool generation in Oracle SQL script
I have a scenario where we generate spool based on condition.
The spool should generate only if user types y.
column col noprint new_value elcm_script
select decode(lower('&gen'),'y','C:\ELCM.SQL','n', 'null') col from dual;
SPOOL…

user3737084
- 7
- 8
0
votes
1 answer
Execute PL/SQL script in C++ using OCCI oracle
I want to run SQL script from a C++ program. my code goes like this:
int main()
{
//.....
sql_stmt = "Insert into t1 values ('qwerty');\nInsert into t1 values ('dothar');"
"//and many more INSERT statements";
sql_stmt =…

MegaByte
- 3
- 3
0
votes
1 answer
Generate the output in same spool in Oracle
SPOOL c:\out.SPL
SELECT * FROM a WHERE ACCOUNT_NUMBER='&CRN' ;
SELECT * FROM b WHERE ACCOUNT_NUMBER='&CRN' ;
Spool off
accept op prompt 'Do u want to generate el spool,type y ' default 'n'
SAVE c:\query2.SQL
select *…

user3737084
- 7
- 8
0
votes
2 answers
Generate spool in based on condition in Oracle sql
I need to write an oracle sql script based on some condition.
Like User has to type 'y' or 'n' if he types 'y' then i need to
accept gen prompt 'Enter y if you want to generate spool' default 'n'
spool c:\a.spl
SELECT CUST_ID INTO NO
…

user3737084
- 7
- 8