Questions tagged [sql-scripts]

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.

437 questions
1
vote
0 answers

Best Practice - Spring Test - keep SQL structure up to date in testdata scripts

Spring Boot Application - MySQL - JUnit - Jenkins - Maven - Maven Sql Plugin I currently use the Maven Sql Plugin to reset the Database Structure (structure only) on my Testserver, before every testrun. Every Test uses @Sql("script") annotation to…
Sunchezz
  • 740
  • 6
  • 21
1
vote
1 answer

Extract complete login settings

I am using SQL Server 2017. I have created a login with mapping and various roles. How can I get the create script of the complete login? The script must contain all mapping and role information. Thanks for any help
user3417479
  • 1,830
  • 3
  • 18
  • 23
1
vote
0 answers

sybase script don't understand trouble

I 'm not a regular of Sybase ASE. Tring to make a script to add line into a tempory table. sybase version 12.5.4 BEGIN declare and init variable --boucle select * into #parTemp from Parution where 1=2 WHILE @dateCourante <= @dateFin BEGIN …
label55
  • 125
  • 7
1
vote
2 answers

Insert data to Master and Detail table at the single script with multi-data using T-SQL

I've to insert data to Master and Detail records, however what can I do if I need to insert both data at the single script with T-SQL. Question 1.How can I get the Master Index Key(Identity increment) when data's was inserted 2.and then get Index…
Willie Cheng
  • 7,679
  • 13
  • 55
  • 68
1
vote
1 answer

mysql performance website tables

Hello everyone, I am designing a website and want to build a database which deals with comments, searches, holding all information, users, and holds all information. I want to know if there is more than one way to create efficient tables and speed…
Randomfan
  • 17
  • 3
1
vote
1 answer

Is a sql script acceptable solely by PostgreSQL server, or by both server and client psql?

Is a sql script interpretable solely by a RDBMS such as PostgreSQL server, or by both the server and a client such as psql? Can the server accept a SQL script file, or only a client can? My question comes from learning that in psql, \i can be used…
Tim
  • 1
  • 141
  • 372
  • 590
1
vote
3 answers

SQL Script - two delete statements

I found this code into our repository and I need to modify the statement. However, I am bit hesitant because I am wondering, why does it have two delete statements? I've tried to debug it, remove the first delete, it didnt work. I understand that it…
xscape
  • 3,318
  • 9
  • 45
  • 86
1
vote
0 answers

Sqlcmd parameter passing to sql script file

Is there a way to get a script file that will be executing via SQLCMD to accept the parms passed in the SQLCMD call.. i.e. I need to input the DbName variable from the user. Below is the code I am using to automate an sql script file through…
1
vote
1 answer

Chained REPLACE functions substitute only one value at one query execution

In the tuples under Album_IDs 1 and 8 I want to replace the 'Genre' field values of 'Alternative' with emptiness (''). But when I'm executing this SQL-script, it replaces only one value at once. Is there a way to leave the half of the string…
dima_mayd
  • 55
  • 8
1
vote
2 answers

RDBMS change table relation OneToMany to ManyToMany. SQL script

I use postgresql. In db I have important element: |---------| |------------| | account | | calendar | |---------| |------------| | id |1--*| account_id | |---------| | id | |------------| and this part must…
Sergii
  • 7,044
  • 14
  • 58
  • 116
1
vote
0 answers

Liquibase - DBMS specific output's are not captured in log files

We are using Liquibase 3.5.3. We are looking to capture the DBMS specific outputs in Log files , but none of the above options (--logLevel=debug,Warning,Error,severe) are does that need. i.e.: while using select * from table inside the sql script,…
Arulmani
  • 11
  • 3
1
vote
1 answer

SQL script, how can i execute the following script?

I have to execute this script . The problem in that in SQL Developer i cant run it,since some operators are not recognized . P_jobgroup_id : 'GDWH2MYGDWH-GDWH2MYGDWH' CORE load finished 'GDWH2MYGDWH-GDWH2MYGDWH_IF' IF…
eda
  • 17
  • 2
  • 2
  • 8
1
vote
1 answer

Time missing when running query using Oracle sqlplus

I have the following script that I am running using sqlplus set headsep off set pagesize 0 spool 'c:\file.csv' select to_char(trunc(created_date, 'hh')) AS reg_date, count(*) from ORDERS.PRODUCT WHERE CREATED_DATE >…
Saqib Ali
  • 3,953
  • 10
  • 55
  • 100
1
vote
1 answer

SQL script create stored procedure - importing error

My SQL script (sproc.sql): use timetable_db; DROP PROCEDURE IF EXISTS GetEmptyClassrooms; delimeter | CREATE PROCEDURE GetEmptyClassrooms() BEGIN SELECT room_number,seats from classrooms WHERE room_number not in (SELECT room_number FROM…
atanii
  • 226
  • 2
  • 12
1
vote
1 answer

How to use query scripts as IQueryable or DBSet in Entity Framework

I'm using entity framework code first to query database, the problem is I'm not allowed to create views in the database, so I should use query scripts in my codes. I want this query script to be considered same as DBSet or IQueryable by entity…
Farzin a
  • 11
  • 2