3

Ok, this might be bit silly question but I can't seem to find any viable reference to what I need.

I'm going through NHibernate tutorial and with code I got this DDL scripted database. I know few facts on DDL but never worked with it to be honest. So I have no idea how to create a database from it on my server. Of course, I've just tried running it but nothing happens (as expected eh...).

Note: I'm running SQL Server 2012.

Please do help even if this might be too stupid to ask.

Thanks.

2
  • did u try looking at: stackoverflow.com/questions/602768/… Commented Oct 26, 2012 at 13:41
  • Yes. That exact one(among others). But most of the questions/tutorials I've encountered are referring to .sql scripts. Are ddl scripts the same? That's what makes it troublesome... I could possibly recreate this database by reading the script but there are lots of those, so I figured there must be a way to generate it from the given file (create_database.ddl namely). Commented Oct 26, 2012 at 13:47

3 Answers 3

2

"DDL" stands for "Data Definition Language"; it's a blanket term for SQL statements that create and modify schema objects — statements like CREATE TABLE ... and ALTER TABLE ... and CREATE INDEX ... and so on. (It's as opposed to "DML", "Data Manipulation Language", which is SQL statements that merely modify the data in those objects — statements like INSERT INTO ..., UPDATE ..., and DELETE ....)

Your .ddl file is probably just an ordinary SQL script consisting of DDL statements; the extension .ddl is for the benefit of human readers, so they know what kind of SQL script it is. But if you know how to run a .sql script, then you can probably run your .ddl script in the same way.

(If you're worried, you can first try opening your .ddl file in Notepad, and confirming that what it consists of is CREATE TABLE ...–type statements, before actually running it in your database.)

Sign up to request clarification or add additional context in comments.

2 Comments

Well that's just it. I did open it. And ran it as usual figured nothing special about it, it even ran perfectly without errors, but it didn't create anything... Which threw me off quite a bit, so I thought maybe it's because it's ddl...
@user1407758: Then -- nope, it's not because it's DDL. Something else is going wrong.
1

if you want the script that creates the database, it should be on this format

CREATE TABLE <table name> ( 
    <attribute name 1> <data type 1>,
    ...
    <attribute name n> <data type n>
    );
  • replace the angle brackets AND its content entirely with your values*

reference: http://www.tomjewett.com/dbdesign/dbdesign.php?page=ddldml.php best of luck :)

Comments

0

This may sound dumb, but I recently did something very similar in mssqlmm and was quite confused as to why I could not find the new created database from the script I had just run. Turns out I just had to click the refresh button on the left hand pane before it showed up in the databases tree.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.