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
0
votes
0 answers

How do I select record with no pair?

Hi guys I hope you can help me, How do I pair the same record but also I want to select the record that has no pair like the 95 in the credit. Here is my code I can actually pair the same record on Debit and Credit but also I want to show the…
Carlo Angeles
  • 29
  • 1
  • 4
0
votes
1 answer

How to set all columns to the same value?

i need help to understand How may i set all nvarchar value with same ides in table to the same id's nvarchar value of table b? insert into TableA select CAST(Id as nvarchar) from TableB where ID in (select ID] from TableA)
maxfido
  • 45
  • 5
0
votes
0 answers

How to pass param from bat script to sql script

test.bat SQLCMD -s SQL-SL_SQL01 -E -I “C:\Users\sqladmin\test.sql” -v p = "%1" test.sql EXEC xp_instance_regwrite N'HKEY_LOCAL_MACHINE' , N'SoftwareMicrosoftMSSQLServerMSSQLServer' , N'DefaultData' , REG_SZ , N’${p}’ GO In cmd prompt, passing this…
0
votes
1 answer

db2 - Bulk rows update with select on different tables

I wanted to update a column for multiple rows based on the below condition - I want to update column AUUSRTX of file abhipsha/AUDUSERF only for those rows WHERE AUDUSERF.AUUSRTP <> 'USR' and AUDUSERF.AUUSRTP <> 'usr' and the value that needs to…
0
votes
0 answers

SQL Server script equation

I have a SQL Server table that contains some data and I need to do some complex equations to get some result in same table The table structure and data like the following: A B C D …
Amr Elnashar
  • 1,739
  • 12
  • 33
  • 53
0
votes
0 answers

Trying to achieve Excel's VLOOKUP function in SQL

I am trying to achieve the VLOOKUP function in my SQL server by running a SQL script. For small example, my tables look like: TableA ID Type and a lot other columns 123 A xx 321 B yy 213 C zz TableB Number Type and a lot other…
liiiii
  • 11
  • 1
  • 4
0
votes
0 answers

CREATE TABLE script duplicating columns on some tables

My script that I've altered from the answer here is making duplicate columns in only SOME of the tables. I can't figure out what the problem is. The purpose of the script is to generate CREATE TABLE statements for already existing tables. If it…
moni
  • 3
  • 4
0
votes
1 answer

Facing issues while running pl/sql script

rebuild the udev rules in the /etc/udev/rules.d/99-oracle-asmdevices.rules file by running the following script: i=1 cmd="/sbin/scsi_id -g -u -d" for disk in sdb sdc sdd sde sdf; do cat <>…
0
votes
2 answers

How to pass parameters from Perl script to SQL script and execute it from Perl script?

I use Informix as database in Linux environment. I have a Perl script which should execute an SQL-script. Before execution, it should also pass all parameters to the SQL-script. I can't figure out how to pass parameters to .sql script? It also does…
itro
  • 7,006
  • 27
  • 78
  • 121
0
votes
4 answers

Tired of typing SQL scripts like "SELECT TOP 10 * FROM" and other similar scripts. How to create an alias/shortcut in SSMS?

While doing a lot of research at my work I keep writing generic scripts like "SELECT TOP 10 * FROM" etc. Is there a way to for me to write something like a snippet so that when i type "ss" + Space/Tab it will insert the "SELECT TOP 10 * FROM"…
Nathan
  • 24,586
  • 4
  • 27
  • 36
0
votes
2 answers

How to view .bak file from DATABASE BACKUP in SQL Server on Docker

How does one go about viewing a .bak file when they script out a backup command? For example when I run a script that has this SQL in it: DECLARE @database NVARCHAR(75) = 'MyDatabase'; DECLARE @filename NVARCHAR(75) =…
CoderLee
  • 3,079
  • 3
  • 25
  • 57
0
votes
1 answer

data.sql script for a H2 database is executing after my application is running for SpringBoot

I am assuming my data.sql script for a H2 database is executing after my application is running, hence, findById()(CRUD Methods) are not fetching any data(NULL). How can I fix this? Please find my log details: 2020-10-12 18:52:01.361 INFO 30872 ---…
Onisha
  • 21
  • 1
  • 4
0
votes
4 answers

Creating required script

My question is about select statement. I have a table called test1 and the values in it. Here my script for creating the table, and inserting values: create table test1(id number, pc number, pe number); insert into test1 values(12,0,900); insert…
Rahid Zeynalov
  • 172
  • 1
  • 10
0
votes
1 answer

How to call SQL scripts from snowpipe

I have created a file with multiple DMLs. And then I call that file from SNOWSQL client. Is is possible to do that same via snowpipe so that I don't need to call the file manually every time? Below is the script that I am using in snowsql…
0
votes
0 answers

Magento 2 single site to magento 2 multisite database migration

We are having 3 different magento 2.0 stores CE functionally migrated to magento 2.4 multisite environment with test data. We want to migrate actual data from all 3 sites to new portal. Is there any tool/script available? Which tables do we need to…
kushal mehta
  • 54
  • 1
  • 4