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
1 answer

Programmatically alter a sequence in SQL Server

I'm preparing a data migration script in which I need to alter a previously created sequence to a new value. Here is what I tried so far: DECLARE @Curr_Sampling_Request_ID INT ; SELECT @Curr_Sampling_Request_ID = MAX (Sampling_Request_ID) FROM…
FDavidov
  • 3,505
  • 6
  • 23
  • 59
0
votes
1 answer

Using path relative to SQL script location in that script?

I have a sql script in dir:\some\path\script.sql This script is executed via SqlDeveloper and spools some data into dir:\some\path\data\tablename.csv Now, I have to store the script in a .sql file because if I execute it from SqlDeveloper…
Jdv
  • 962
  • 10
  • 34
0
votes
1 answer

Enabling mysql slow query log during a certain time

I would like to enable the slow query log during a certain time interval every day - 00:00:00 UTC to 00:10:00 UTC. Is there any method to enable the slow query log in such a manner?
Annie
  • 135
  • 2
  • 15
0
votes
1 answer

I want to sql script input string and value in database is number?

I want to sql script in select input string and value in database is number? EX. Input: Wait Approve ApproveStatus(nvarchar) "0" "2" "4"... ApproveStatus = 2 It's "Wait Approve" I want sql script find value "Wait Approve" in ApproveStatus and…
0
votes
0 answers

ERROR ORA-00942 and ORA-04080 while Installing the HR Schema

Newbie here. Trying to setup the hr sample schema on ORACLE12C - CENTOS box but get two error codes. $ sqlplus connect as sysdba SQL*PLUS Release 12.1.0.2.0 Production on Tue Jan 31 04:50:15 2017 Enter Password: Connected to: Oracle Database…
0
votes
0 answers

Run Sqlscript in installshield

I want to run an sql server script while setuping my c# application .so I use below script but I get error USE [master] GO /****** Object: Database [HoghooghDastmozd] Script Date: 02/11/1395 11:12:19 ب.ظ ******/ CREATE DATABASE…
0
votes
1 answer

Drop column with PK constraint in empty table in a script

Scenario A table in SQL Server has two or more columns, but the original column with the primary key constraint is no longer needed. So now you want to write a script to drop the original column w/ a PK constraint and put the PK constraint on a…
AndrewRalon
  • 496
  • 1
  • 9
  • 24
0
votes
2 answers

Run custom script in SQL Server Express

I am trying to run a script on Task Scheduler to update a column in my database every 1 hour. I have table vw_invoices and a column ExportLock with a default value of 0 which is "unlocked". I want to run a query to update ExportLock to 1. Currently…
0
votes
1 answer

How to migrate Data From Ms access to Derby Database or How to migrate Data from My sql to Derby Database

I have used many tools but they not work correctly and when i start migration process, they generate the Null value error. Also I have tried to migrate usingSql script to insert data in derby table but they not work it. So basically my question is:…
Yash Pathak
  • 9
  • 1
  • 5
0
votes
2 answers

Migrate association column in PSQL

I have a table that we've run into an issue because we made a wrong assumption that Table A associates with Table B but it should be Table C. It's only an issue now that we're adding a feature but I'm not sure how to properly migrate it. Best way I…
Oscar Godson
  • 31,662
  • 41
  • 121
  • 201
0
votes
2 answers

How can I manage my SQL query script in asp.net mvc project?

I am using Dapper to process data. Here is a code sample: using(var connection = new SqlConnection(ConfigurationManager.AppSettings["MyConnectString"]) { var sql = string.Format( @"SELECT [Column1] FROM [MyTable] …
Max
  • 4,439
  • 2
  • 18
  • 32
0
votes
1 answer

how to export results to CSV in a loop

I have a SQL query select time,t_count,sum(t_count) over (order by time) as cumulative_t_count ,cumulative_t_count/sum(t_count) as percentage_cumulative count,state,hour from (select distinct time,count(distinct num_id) as…
John
  • 305
  • 2
  • 4
  • 18
0
votes
2 answers

Memory allocation failed: How to combine four result sets into one table

I have four tables. Every table has just one column with 32768 rows, like: |calculated| |2.45644534| |3.23323567| [...] Now I want to combine these four results/tables into one table with four columns,…
Tobias
  • 4,921
  • 4
  • 31
  • 40
0
votes
1 answer

Injecting sql scripts from an SQL file into sqlite database in javascript

I have an html page that creates an sqlite database using the openDatabase function. As I have an existing and large sqlite database, I wonder if I can import it into that web created sqlite database instead of putting my sql code in the…
Zakaria
  • 14,892
  • 22
  • 84
  • 125
0
votes
1 answer

SQLScript: scalar type is not allowed

I have the following sql command: SELECT DFT(weighted, 32768 ORDER BY rel_id).REAL as four FROM :fith This function returns an array with 32769 elements in one cell. Now I want to use the unnestfunction to split the result. Therefore I need to…
Tobias
  • 4,921
  • 4
  • 31
  • 40