ddl

Best database independent SQL DDL utility?

I'm working on a project for the .net platform and would like to support multiple database types. I would like to keep the DDL under source control in a generic format then convert it to database specific DDL for deployment. So I'm looking for utilities that will convert generic DDL into database specific DDL. Ideally it would support M...

ALTER TABLE without locking the table?

When doing an ALTER TABLE statement in MySQL, the whole table is read-locked for the duration of the statement. If it's a big table, that means insert or update statements could be locked for a looooong time. Is there a way to do a "hot alter", like adding a column in such a way that the table is still updatable throughout the process? ...

generate DDL for sybase tables and indexes

I'm looking for a command line tool to generate DDL for both tables and indexes (nothing more complicated is needed) for some sybase tables in databases I take care of. I have access to gui tools for viewing at individual DDLs, and I could cut and paste them, but I want something that will go through all the tables in a datbase and gene...

Specify order of fields in DDL generated from GORM classes?

I use GORM to generate my database's DDL from groovy classes. Which is great. However, the order of fields in the generated SQL is not the same as the order of fields in the class. For example, if I create the class class Person { String firstName String lastName String address String email } the following SQL is generated ...

How do you disable all table indexes in sql server compact edition via an SqlCeCommand Object?

I'm trying to do a huge bulk insert into an SqlCe database (version 3.5, oh and using C# 3). I've tried various ways of doing this (table adapter insert, a prepared parameterized query, sqlceresultset insert etc.). The fastest time, as I've read on many sites, was using the SqlCeResultSet object, in table direct mode. I want to speed th...

Obfuscating source code when publishing (C#)

Hi, We are working on many products that are being published at our customers. But if you publish a C# application, all the dll's can be decompiled using reflector or some sort. I was wondering if there is an easy way to encrypt our dll's when publishing. This way we can publish our dll's without having to worry about our clients decom...

Fluent Nhibernate Schema Generation

Hi, I have been playing about with FluentNhibernate as part of the S#arp Architecture. Below is an example mapping. public class EventBaseMap : ClassMap<EventBase> { public EventBaseMap() { WithTable("Event_Header"); //NotLazyLoaded(); Id(x => x.Id).WithUnsavedValue(-1).GeneratedBy.Native(); M...

DDL not executing properly inside of an IF NOT EXISTS statement on SQL Server 2005

I have a fairly complex database that needs to be deployed to a variety of servers which may or may not potentially have existing parts of the DB already implemented on it. To work around this contingency I have setup the following test: USE [testDB] GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO SET ANSI_PADDING ON GO IF NOT EXIST...

Using Visio to generate MySQL DDL

I have a database model diagram created in MS Visio which I would like to export to DDL file to create a MySQL database. I've already installed the MySQL ODBC driver, which I can successfully use to generate DDL file, but I have some problems anyway. Visio puts quotation marks around the table names which are also reserved words (like u...

Reverse engineer DDL from JPA entities

I'm playing around with some JPA stuff, changing the mappings to see how they're supposed to be etc. It's basic experimentation. However I can't find a tool that will simply read my entities and then generate the table schema for me. I tried to find something like this in JBoss tools but nada. Eclipse integration will be a huge plus but ...

Alter Table Add Column Syntax

I'm trying to programmatically add an identity column to a table Employees. Not sure what I'm doing wrong with my syntax. ALTER TABLE Employees ADD COLUMN EmployeeID int NOT NULL IDENTITY (1, 1) ALTER TABLE Employees ADD CONSTRAINT PK_Employees PRIMARY KEY CLUSTERED ( EmployeeID ) WITH( STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP...

Linq to XML to Generate DDLs

We're storing out database definition as XML in the format at the end of this question. The problem I'm having is getting a list of schemas, the tables in those schemas, the columns in those tables (all with their associated information). My current code (included below the sample XML) grabs everything, completely ignoring nesting and, d...

Unit testing DDL statements that need to be in a transaction

I am working on an application that uses Oracle's built in authentication mechanisms to manage user accounts and passwords. The application also uses row level security. Basically every user that registers through the application gets an Oracle username and password instead of the typical entry in a "USERS" table. The users also receive ...

SQL Server Dynamic Columns Problem

I use a table GadgetData to store the properties of gadgets in my application. There gadgets are basically sort of custom control which have 80% of the properties common like height, width, color, type etc. There are are some set of properties per gadget type that the unique to them. All of this data has to store in database. Currently I...

automated DDL scripts: how much functionality to predict?

I have a script that generates DDL scripts to define materialized views for a normalized database. Some tables have columns like "owner" that point to a particular database user, which I can then create views for that will show only the rows of a table that the current database user created. Such views in some cases would be beneficial...

How do you create a wide table in SQL Server 2008? and what are its limitations on use?

I was reading the Maximum Capacity Specifications for SQL Server and I came across the designation of a wide table. It's different from a standard table in that is can have as many as 30,000 rows as opposed to a normal (narrow) table that is limited to the more familiar 1024 columns. I googled for wide table, but nothing seem to come up ...

Problem Changing Column Order in a Table (SQL Server 2008)

When I try to change this columns list: Nombre Imagen Descripcion Activo IdLineaProducto into this (IdLineaProducto is first) IdLineaProducto Nombre Imagen Descripcion Activo SQL Server Management Studio says that it's not allowed to save changes because the table must be deleted and recreated (in spanish...). I could do this in S...

SQL Server 2000/2005 - Maintaining Development Version and Production Version

I am used to using Oracle Designer by creating database object definitions, then creating DDL SQL required by connecting to a database instance. For eaxmple, when adding a new column to a table, first I add it to the table definition, then generate the DDL SQL against the development version and run it, then after testing I point to the...

SQL Server: Extracting a Column Into a Table

I have a table with a column that I want to extract out and put into a separate table. For example, lets say I have a table named Contacts. Contacts has a column named Name which stores a string. Now I want to pull out the names into another table named Name and link the Contact.Name column to the Id of the Name table. I can only use ...

nHibernate SchemaUpdate Failing

I'm trying to use the schema update feature in nHibernate against an Oracle 11g database and it's throwing the following exception: "More restrictions were provided than the requested schema ('Tables') supports." It appears to be an ado.net exception, but I can't find much information for it. Any insight towards this exception would be...