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
-1
votes
2 answers
Error: Column doesn't exist in table (Foreign Key referencing)
Question
I am trying to link the ID column from the Customer's table to C_ID in the Purchases table. I am still learning SQL so I have a light knowledge and am not sure why this error is occuring. If someone could offer up a solution and point…

Aidan
- 470
- 3
- 7
- 16
-1
votes
2 answers
SQL - GO in IF Condition
I need to make a SQL-Script, which can be executed multiple times on the same DB, to check if a table already exists. If yes don't do anything, if no create the table and insert some data. The problem is, that I can't use 'GO' inside the BEGIN and…

Helvetios
- 76
- 8
-1
votes
1 answer
Fluent Nhibernate and sql script
I want to execute a script with variables in order to create a new database.
At first, i tried with command line but i want to execute the script from another server but i have errors about access rights.
Is it possible to execute a SQL script with…

Tiphanie Aubry
- 11
- 4
-1
votes
1 answer
SQL Server - is there option to generate insert script just to not null columns (required columns)?
I have a big table and for tests I would like to generate a script from SQL Server just for these columns. I think there isn't this option... just a full script and I'll need to remove each one.
Just to confirm.
Thanks! who knows.

c2s
- 43
- 1
- 1
- 4
-1
votes
1 answer
How to create a SQL Server insert script that has various variables,and conditions?
I have very limited knowledge of creating SQL scripts for SQL Server. I need to create a pretty simple script that inserts downtime records to be posted for future dates within a database. We have daily maintenance so I'll need to post a notice for…

Mike
- 419
- 1
- 6
- 22
-1
votes
1 answer
How to check DB table values in SQL stored procedure with C#
May I know how to check the values in a database table when there is no exist data?
I wrote this SQL script and C# code to test the condition statement. But it doesn't work.
In SQL stored procedures I have tried Select * from Table and check if the…

Caulson Chua
- 29
- 2
- 9
-1
votes
1 answer
How to make a statement starting with '#' not considered as a comment in an SQL script?
I have written a query in an SQL script (to be run on a Unix system) where I have to insert a few rows in a table in a column named 'funcs' and the name of the functions which I am inserting in this column have to all be in a new line (as shown…

MK Singh
- 706
- 1
- 13
- 36
-2
votes
1 answer
How do I convert an SQL script into actual viewable data sets to include in my portfolio?
I am a complete newbie. Transitioning into data analytics. Currently at the stage of getting my hands dirty with portfolio projects to ensure I'm more marketable, hehe.
I completed one of these interactive guided projects. The problem is, the only…

Vadamme
- 1
- 3
-2
votes
2 answers
How to execute the statements in .sql file contains Go, single line and multi line comments using C#?
I have a .Sql file containing a number of statements including
Go
--Single-line comments
/*
Multi-line comments
*/
How can I execute this file using c#?
Please suggest to me some ideas.
Thank You:)

Aravind C S
- 53
- 7
-2
votes
3 answers
Trim the data and put in separate columns
I have a below records in the table with single column .
**Name**
Aaa.bbb:ccc;ddd;eee;fff
Www.xxx:yyy;zzz;rrr;hhh
I am looking for a output something like this :
Name1 name2 name3 name4 name5 name6
Aaa bbb ccc ddd eee fff
Www …

Bo_2000
- 7
- 2
-2
votes
2 answers
Is echo vallid syntax in teradata BTEQ
Can any one please explian me the below bteq code.
Is this script valid?
exec 1> $CODE/edlr2/logs/AGP_MBR_BTEQ_CSA_MBR_STG_LOAD_$(date +"%Y%m%d_%H%M%S").log 2>&1`echo "script file =" $0 PARM_FILE=$1 echo "parm file= "$PARM_FILE.parm .…

XYZ
- 27
- 6
-2
votes
1 answer
why is 'create table' in sql script executing 3 times when only using 1 create statement?
I have an SQL script in which I want to automate the creation of a table.
However, when I exec it, it seems as though it's trying to create the table 3 times.
The first time, it creates the table. The next 2 times, it complains it already exists by…

GeekyMiss
- 11
- 2
- 9
-2
votes
1 answer
How to create if-then-else statement in an oracle sql script?
I am writing an sql script, whitch should ask a question, and the continuing would depend on the user's input.
I have tried this:
prompt script started
accept partitioning prompt "Do you want to partition the table? (Y/N):"
if ($partitioning=Y)
…

victorio
- 6,224
- 24
- 77
- 113
-2
votes
1 answer
how can i create a new database base on a sql script
I have generate a "schema only " database script for my staging database, using sql server 2008 r2 . now i need to execute the script to create the same database including (table, column, keys, etc) inside the production server. so my question i how…

John John
- 1
- 72
- 238
- 501
-2
votes
1 answer
How to come up with a script for modifying an existing table in the database without losing the existing information?
I have an application with a database which they are working well and everything is fine.
Now, I just need to modify one table in the database by adding more columns to it. I am using SQL Server and the database administrator asked me to provide…

Technology Lover
- 143
- 1
- 5
- 22