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
3
votes
4 answers

please help me with Error 27506 Error executing SQL script

I'm trying to create a setup file using InstallShield 2010 for my project which uses SQL Server 2008 Everything is ok all necessary programs are being installed but when I try to install my project it will give this error Error 27506. Error…
Scorpio
  • 153
  • 1
  • 5
  • 13
3
votes
1 answer

Should I explicitly "SET IDENTITY_INSERT [Table] OFF" after turning "ON"?

Does SET IDENTITY_INSERT [Table] ON persist beyond the scope of a SQL Script? I'm wondering if I need to explicitly set it to "OFF" or if SQL Server knows that it should only use that setting for the current script. Thanks!
Mark Carpenter
  • 17,445
  • 22
  • 96
  • 149
2
votes
1 answer

Invalid column name 'XXXXXXXX'

I have a sql script say "abc.sql" which I am calling from a batch file using sqlcmd like Calling batch script like script.bat arg1 arg2 In batch param1=%1 param2=%2 Then calling SQL script like sqlcmd -S server -i abc.sql -v var1=%param1%…
Rahul
  • 76,197
  • 13
  • 71
  • 125
2
votes
2 answers

How can I su from root to db2inst1 and invoke a SQL script, in one line?

How can I su from root to db2inst1 and invoke a SQL script all in 1 line? I am thinking about something like this: su db2inst1 | db2 CONNECT TO myDatabase USER db2inst1 USING mypw; db2 -c -i -w -td@ -f /tmp/deploy/sql/My.sql | exit; Any ideas?
mordechai
  • 127
  • 2
  • 10
2
votes
2 answers

SQL Server 2008 column in only one table

First a quick explanation: I am actually dealing with four tables and mining data from different places but my problem comes down to this seemingly simple concept and yes I am very new to this... I have two tables (one and two) that both have ID…
2boolORNOT2bool
  • 557
  • 3
  • 9
  • 23
2
votes
2 answers

IBM i Access Client Solutions (ACS) Run SQL Scripts - print variable

is there an easy way to display/print a variable on the output of the IBM i ACS Run SQL Script screen? For having a quick check when writing a script it would very helpful to be able to display the content of a variable. E.g. in below script, I want…
KoenS
  • 39
  • 3
2
votes
1 answer

Changing the default "Processed xx total records" for scripting SQL data

In SQL Server 2008, you can right-click on a database and select "Generate Scripts...". You can then choose a particular table and choose "Data only" under the "Types of data to script". When you do this, it automatically inserts a line in the…
Loki70
  • 613
  • 4
  • 15
  • 36
2
votes
1 answer

Would removing 'OPTIMIZE_FOR_SEQUENTIAL_KEY' solve the failure of my script.sql or is more involved (SQL Server Express DB -> SQL Server)?

I am trying to set up my SQL Server Express database on my hosting site (GoDaddy/Plesk) as a full-fledged SQL Server DB, but have run into a series of error messages running the script.sql file. I am following the steps here to set up my DB, first…
2
votes
4 answers

How to download all views stored in snowflake to local machine

I want to create a backup of all SQL scripts (views) that are saved on snowflake (not data). How can I do it? Obviously manual copy and pasting is not an answer. Expected result: I have all views (sql scripts) that are in snowflake database on my…
2
votes
1 answer

Making git diff (NOT difftool) and git log -p work with *.sql files and Windows PowerShell

I know how to configure an external tool to view differences with a call to git difftool. However, if I want to see an 'dump' of all changes for entire history of a file to my console window, I wanted to use git log -p . The problem I'm…
Terry
  • 2,148
  • 2
  • 32
  • 53
2
votes
1 answer

How do I write the table structure in Oracle from an existing schema?

I have so far figured out that to describe a table I can use the below: select dbms_metadata.get_ddl('TABLE','','') from dual; I also found that I can get a list of tables from the current user using the below…
Prasanna Narayanan
  • 437
  • 1
  • 3
  • 13
2
votes
3 answers

How to create an average per partitions containing a maximum of 5 time dependent members?

My goal is to select an average of exactly 5 records only if they meet the left join criteria to another table. Let's say we have table one (left) with records: RECNUM ID DATE JOB 1 | cat | 2019.01.01 | meow 2 | dog |…
wounky
  • 97
  • 1
  • 12
2
votes
1 answer

Docker compose does not execute .sql

Trying to use docker compose for my application, so using official mysql images and my own Dockerfile to create my app image. I think some how my initdb.sql is not executed during docker compose up. Running this as : docker-compose up --build But…
Karol
  • 165
  • 2
  • 6
  • 19
2
votes
1 answer

SQL Script to Insert New Record Per Id

I have a SubQuestionScoreLink table that links a SubQuestion with all available Score options that will appear in a dropdown on the web site. As you can see from the example below currently 7 Scores are used per SubQuestion. I've created a new Score…
Bad Dub
  • 1,503
  • 2
  • 22
  • 52
2
votes
2 answers

How to switch database context to newly created database?

I wrote a script to create a database: 1: USE master; 2: IF (db_id('myDB') is null) 3: CREATE DATABASE myDB; 4: USE myDB; but it does not work... I got an error: Could not locate entry in sysdatabases for database 'myDB'. No entry…
SKINDER
  • 950
  • 3
  • 17
  • 39