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

Run multiple commans or sql script using OLE DB in SQL Server

It is possible to run multiple commands or sql script using OLE DB? For example to run sql script to create database and its structure (tables, indexes, stored procedures...). When I use CCommand class, I can run only one command. How can I run SQL…
Martin Pilch
  • 3,245
  • 3
  • 38
  • 61
1
vote
1 answer

Windows Azure SQL Scripting

I am in the process of creating a simple script for a Windows Azure Hosted Database, that will change the value of one column in one table. The script needs to be scheduled to run every 24 hours. Pretty basic stuff I would have thought. However my…
1
vote
2 answers

Show SQL server script error in WIX setup

I've a setup project in VS2013 using WiX. The setup executes SQL scripts on SQL Server. I'd like to find a way to add raiserror messages (with severity <11) into installation log and show them to a user.
Leo Y
  • 659
  • 7
  • 22
1
vote
2 answers

regular expressions on sql file

I need to perform a search and replace operation on hundreds of SQL script files. The idea is to transform this: CREATE PROCEDURE [dbo].[proc_whatever] ( @id INT, @parameter VARCHAR(1) ) AS BEGIN ... END Into…
ab_732
  • 3,639
  • 6
  • 45
  • 61
1
vote
2 answers

Sybase: Generate a script Between two SQL?

I've a Sybase database where I will make a LOT of changes, and I would like to make my changes (currently using PowerDesigner 16), save it as .SQL then generate a .SQL to migrate my initial database to the new database structure. I don't care about…
J4N
  • 19,480
  • 39
  • 187
  • 340
1
vote
1 answer

Deleting empty spool file when no data

I have a sql script which creates a spool file. When I do not have data, I am getting an empty file created. I do not want the file to get created in that case. How can I do this? set termout off; set newpage 0; set space 0; set linesize 255; set…
saniya mapari
  • 71
  • 1
  • 10
1
vote
2 answers

How can I store a variable in a postgresql script?

I have the following script where I need to find a given chapter, change the state, then store the activity reference to remove the activity later (because of the FK in chapter_published activity), delete the chapter_published reference and then use…
Fagner Brack
  • 2,365
  • 4
  • 33
  • 69
1
vote
1 answer

Where are the sql files of the default schemas (Oracle database)

What is the location of the sql scripts of say, the emp table creation of the scott schema ?
LockStock
  • 199
  • 12
1
vote
3 answers

How to extract certain text from a text file and replace keyword in another file with this text?

Long story short I have an SQL script that I run when an action falls over, I have a log with has all the information I need and I just replace certain parts of this SQL script with text from the log file. My question: is there a way I can do this…
1
vote
0 answers

mysql assertion in sql script

I have a script that needs to be executed only when some condition is met. For example condition is defined in the following way: select 1 from table_name where id = 123 if query returns row condition is met, otherwise condition is not met and…
michael nesterenko
  • 14,222
  • 25
  • 114
  • 182
1
vote
0 answers

How to load any SQL scripts using Java

I'm working on integration tests and I'm trying to load SQL scripts to set up the database before a test. I don't want to use DbUnit since I want to be able to do more than just inserting data and I'm also looking for better performance. I've tried…
1
vote
0 answers

How to introduce changes in pdm with sql script via PowerDesigner

~~~~~~~~~~~~~~~~ Hi, all! I have a database model xxx.pdm and a sql script I want to apply to the db (so that generated xxx_db.sql, xxx_triggers.sql, etc will contain the changes - the files are used in whole application building process to generate…
1
vote
2 answers

How can I update text within view then update view in script?

Using SQL Server 2008 R2. I need to write a SQL script that will search for specific text (e.g. server name) in existing SQL views, replace this text with another string, then update the view (ALTER VIEW). I can't figure out how I would write this…
axSailing
  • 11
  • 3
1
vote
1 answer

How to get the SQL Server script error in a batch File

I am calling an SQL Server script on a batch file, but I need get the error(when the script fail) in the batch file, what can I do? This is the batch file: sqlcmd -S HOST -U User -P password -i test.sql echo %errorlevel% and this is the Script…
davdomin
  • 1,219
  • 6
  • 18
  • 38
1
vote
1 answer

Aqua Data Studio Server Registration Scripts

I am trying to run a startup script in Aqua Data Studio when a user logs in to any database. I understand that the process for this is to go to Script in the Server Registration box and write the SQL scripts/queries you would want to run when…
CodingInCircles
  • 2,565
  • 11
  • 59
  • 84