Creating db from SQL statements

G

Grey Alien

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 ?
 
M

Mark Rae [MVP]

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 ?

You're in the wrong newsgroup - this one is for ASP.NET issues...

For SQL Server, please post to:

microsoft.public.sqlserver.server

or

microsoft.public.sqlserver.programming
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top