user-defined datatypes created in ''model'' db

  • Hello everybody,

     I had studied earlier that the user-defined datatypes that are created in the "Model"db can be used in all the other db's, but when i tested that it was not working,What is the problem in my creation

  • I just tested creating a user-defined type in model that I called 'testtype'. I then created a new database, and in it a table where I used the type, like this:

    CREATE TABLE foo ( bar testtype NOT NULL )

    This worked perfect. Could you supply more details as to which steps you took so we can see if you are missing something?

  • Yep ORDER of operations matter in this case if you create the DB before the UDT are in model then you are out of luck. BY the way you need them in Model even if your DB already has them internally

     


    * Noel

  • Aha, now that I re-read the question (after reading noeld's reply) I see where the error is made.

    faizjmc: I think you have misunderstood how model is used. All databases do not always have the same types (or other objects) that exist in model. Model is just a template database, so that each time a new database is created it is created as a copy of model. So any objects that exist in model will also exist in the new database. But if a new object is later added to model, it is not automatically added existing databases. But if another new database is then created, that database will of course include the object.

  • Thanq guys..

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply