Re: Creating db from SQL statements
- From: bruce barker <nospam@xxxxxxxxxx>
- Date: Mon, 09 Jul 2007 08:52:51 -0700
in sqlserver use int for integers and identity (which is a property not a datatype) for serial (there is no ansi version)
CREATE TABLE foobar_def(
id int identity PRIMARY KEY,
fkid int references sometable(id)
NOT NULL ON DELETE CASCADE,
name varchar(32) NOT NULL,
kval int CHECK (kval between 1 and 3) NOT NULL
);
CREATE INDEX fb_idx ON foobar_def (name, kval);
-- bruce (sqlwork.com)
Grey Alien wrote:
I have created a database (*.df) file for use with my website. I have files containing DDL and DDM for creating the db schema and stored procedures respectively. However, I have not (as yet) founs out how to "import" the SQL statements into the datbase, to create the required database objects. I would appreciate any help/info that will help me generate the db objects from the SQL statements..
Additionally, I need to 'port' my SQL from PostgreSQl to SQL Server SQL. I would like to use ANSI-SQL as much as possible, and avoid using SQL specific SQL wherever possible. My tables typically look something like this:
CREATE TABLE foobar_def(
id SERIAL PRIMARY KEY,
fkid integer references sometable(id) NOT NULL ON DELETE CASCADE,
name varchar(32) NOT NULL,
kval integer CHECK (kval between 1 and 3) NOT NULL
);
CREATE INDEX fb_idx ON foobar_def (name, kval);
What would be the equivalent syntax to create this table (and index) in SQL Server?
Any one has links to the SQL Server SQL guide ?
- References:
- Creating db from SQL statements
- From: Grey Alien
- Creating db from SQL statements
- Prev by Date: Re: Master page postback.. !IsPostback doesnt work
- Next by Date: Does NetworkCredential itself encrypt user credentials?
- Previous by thread: Re: Creating db from SQL statements
- Next by thread: ENTER key in TextBox in ASP.NET 2.0
- Index(es):
Relevant Pages
|