sql-scripts

SQL Server script: ALTER PROCEDURE - Executing multiple ALTER PROCEDURE into one script without having to select each of the ALTER one after another

主宰稳场 提交于 2019-12-11 00:49:05
问题 I know this is not a big issue, but it tickles me anyway. I have a SQL Server 2005 script to create new data tables, constraints, altering some tables to add columns, altering procedures to take the table changes into account, etc. Everything runs fine until the script encounters my ALTER PROCEDURE statements. The error message is as follows: "Msg 156, Level 15, State 1, Procedure cpromo_Get_ConsultDetails_PromotionBan, Line 59 Incorrect syntax near the keyword 'PROCEDURE'. Here's a sample of

In the Visual Studio SQL editor, how do I get rid of the boxes?

早过忘川 提交于 2019-12-10 22:38:39
问题 I usually create my SQL tables and stored procedures by writing a script inside Visual Studio. This works really well for me except for one simple annoyance: VS puts blue boxes around all the SQL queries and data-manipulation commands. The purpose of these boxes is to draw undue attention to the fact that VS thinks the query can be edited in “Query Builder.” I don’t want to use Query Builder. I just want a nice, clean script that reflects my fantastic vision of what the DB engine should do.

How to work with javax.persistence.sql-load-script-source?

这一生的挚爱 提交于 2019-12-08 02:34:29
问题 I want to automatically insert data into my MySQL tables. Therefore I try to use the JPA property "javax.persistence.sql-load-script-source" in my persistence.xml : <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="my-PU" transaction

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

蹲街弑〆低调 提交于 2019-12-08 01:31:47
问题 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? 回答1: You can use the -c or --command=<command> option to execute a command with su . In your case, something like this: su -c 'db2 CONNECT TO myDatabase USER db2inst1 USING mypw; db2 -c -i -w -td@ -f /tmp/deploy/sql/My.sql' db2inst1 回答2: if using

SQL Server 2012 : How to script all database stored procedures into separate .sql files?

*爱你&永不变心* 提交于 2019-12-07 07:22:35
问题 I want to script all the stored procedures from SQL Server 2012 to Visual Studio 2012 as .sql files (in a different project). How do I do that? I want one .sql file for each stored procedure? I get the scripts using the Generate Scripts in Tasks option after right clicking DB in SQL Server 2012. However, the name of the .sql file is spname.StoredProcedure in each case. I want the name to be spname.sql. Again I don't want the file name to be database.spname.StoredProcedure, I want it to be

How to work with javax.persistence.sql-load-script-source?

回眸只為那壹抹淺笑 提交于 2019-12-06 14:05:09
I want to automatically insert data into my MySQL tables. Therefore I try to use the JPA property "javax.persistence.sql-load-script-source" in my persistence.xml : <?xml version="1.0" encoding="UTF-8"?> <persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="my-PU" transaction-type="JTA"> <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> <jta-data-source>jdbc

SQL Server database last updated date time

你。 提交于 2019-12-04 10:36:59
问题 Is there any sql script to find out when the database in SQL server is last updated? I want to know the last updated date time for the changes done on meta data of the database rather than actual data inside the table. Particularly when: Any new table is created/dropped from Database. Any new column is added/removed from table in the Database. Any new views/Stored Procedures/Functions are added/altered inside the Database. 回答1: Look in sys.objects should be enough, try this query select *

script to restore database sql server from bak file, doesn't work

陌路散爱 提交于 2019-12-03 15:18:26
问题 I have an empty database: DB_Clients And I want to restore the database from a .bak file: OldDBClients.bak This is the path: C:\OldDBClients.bak And this is my script: USE [master] GO RESTORE DATABASE DB_Clients FROM DISK = 'C:\OldDBClients.bak' When I execute it, I get this error message: Msg 3154, Level 16, State 4, Line 15 The backup set holds a backup of a database other than the existing 'DB_Clients' database. Msg 3013, Level 16, State 1, Line 15 RESTORE DATABASE is terminating

Mysql: How to call sql script file from other sql script file?

半腔热情 提交于 2019-12-03 11:04:32
问题 Suppose I have wrote script Table_ABC.sql which creates table ABC. I have created many such scripts for each of required tables. Now i want to write a script that call all of these script files in a sequence so basically I want another script file createTables.sql. Mysql provides option to execute a script file from "mysql" shell application but could find some command like exec c:/myscripts/mytable.sql . Please tell me if there is any command that can be written in sql script itself to call

executing a .sql file in sql plus terminal

↘锁芯ラ 提交于 2019-12-03 10:47:47
问题 I have written couple of sql scripts in a text file and saved them with a .sql extension. I want to execute these scripts in the sql plus terminal without having to manually type the standalone sql scripts, but i'm struggling with it. If someone could list out the steps involved I would be very grateful. I could copy and paste those scripts in the terminal but that is not what I am looking at, I want to see if there is a way to provide the path to the scripts in the sql plus editor. 回答1: If