Questions tagged [database-scripts]

22 questions
40
votes
4 answers

Generate script in SQL Server Management Studio

If I have a table with data in a database in SQL Server, how can I generate a script that will create the table and add the data too? If I right click on the table then select Script Table As > Create to > File, that generates a script to just…
General_9
  • 2,249
  • 4
  • 28
  • 46
26
votes
2 answers

Create database using script at the default path?

I've generated a script of a database in SQL Server 2008. The generated script has the hardcoded path of where the database would be created. I don't want this path to be hardcoded, I want this path to use the default of the database engine the…
Uzair Farooq
  • 917
  • 3
  • 15
  • 25
5
votes
1 answer

How to partition an oracle table by a date column?

I have a table in oracle: CREATE TABLE transaction ( id INT NOT NULL, accountnumber VARCHAR NOT NULL, stmtvaluedate DATE NOT NULL, ... ) And I want to partition this table by the stmtvaluedate column. My goal is to create a new…
victorio
  • 6,224
  • 24
  • 77
  • 113
4
votes
1 answer

how to get DB backup script from Remote Server in MySQL using command-line utility?

Can anybody tell me that how to get DB backup script from Remote Server in MySQL using command-line utility? I'm using a command as follows, but not working: C:\>mysqldump -h -u -p > E:\dumpfilename.sql
Unknown Coder
  • 1,510
  • 2
  • 28
  • 56
3
votes
2 answers

Managing database scripts in your solutions

I usually create a solution folder in Visual Studio and put my DB scripts in them. I always use at least this set of scripts: Drop model Create model script User functions Stored procedures Static data (lookup tables) Test data (not deployed) Then…
Robert Koritnik
  • 103,639
  • 52
  • 277
  • 404
2
votes
1 answer

How to script and load assemblies list to SQL Server?

My SQL CLR procedure depends on log4net, it depends on System.Web.dll. When I upload this System.Web.dll : create assembly [System.Web] from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\System.Web.dll' with permission_set = unsafe; go I see…
ZedZip
  • 5,794
  • 15
  • 66
  • 119
1
vote
1 answer

How to setup and cleanup my Database before and after the UI tests run

I am trying to automate ui tests on my Silverlight App. I need to setup and clear my Oracle Database when I run the tests. I've created a script: "setup.sql" where I define the the query that I want to execute. I add this file on the Deployment Tab…
1
vote
1 answer

Most efficient and easiest way to back up a portion of specific tables hourly

I need to create an hourly .SQB backup file of some specific tables, each filtered with a WHERE clause, from a SQL Server database. As an example, I need this data: SELECT * FROM table1 WHERE pk_id IN (2,5,7) SELECT * FROM table2 WHERE pk_id IN…
1
vote
1 answer

Generate script Insert in .net

I have problem when trying generate script insert with specific condition. So far I am already trying this step. Add references Microsoft.SqlServer.ConnectionInfo and Microsoft.SqlServer.Smo Add reference in code…
1
vote
1 answer

Design SQL schema in Visual Studio and auto-generate SQL script to create and upgrade database

I don't know much about SQL but this is what I want: Visually design an SQL database schema in Visual Studio Let VS generate a create script for this database Track modifications to my schema and automatically generate upgrade SQL scripts Generate…
Andreas Zita
  • 7,232
  • 6
  • 54
  • 115
1
vote
2 answers

Google ScriptDB: How to retrieve a Key Value Pair using a variable?

I am using Google UI Apps and ScriptDB, and I have a map object similar to this: myMapObject = {record_id: projectA, apple : 316, orange : 956, banana : 536} I am wondering how to use a variable in a…
user2943227
  • 73
  • 10
1
vote
1 answer

Check if oracle script is valid and will run ok on another database

I'm wondering if there is a tool that will let me check if a oracle script will run fine on another database (if my script from DEV db will run ok on QA db). I don't want to run/execute anything there (I dont have permisson), I just want to verify…
ardal
  • 1,537
  • 3
  • 14
  • 18
0
votes
0 answers

Problem get Script from Database with .net Core 7

I want to get a script from my database, but it gives the following error: System.NullReferenceException: 'Object reference not set to an instance of an object.' Microsoft.SqlServer.Management.Smo.TableCollection.this[string].get returned…
0
votes
1 answer

Debugging Mysql Stored Procedure using TOAD for Mysql

I installed the freeware version of TOAD for Mysql and tried using it to run and execute a stored procedure in debug mode (procedure tab then right-click on the SP then choose 'Debug'). I placed a breakpoint then run (f11), but nothing happens.…
0
votes
0 answers

Sql Server Back Up

I'm using the below to backup a db from a SQL job. Can someone tell me how to add the current date to the output filename? Preferably in YYYYMMDD format.
1
2