Update Database from Model to specified Schema

2 posts, 0 answers
  1. David
    David avatar
    11 posts
    Member since:
    Jun 2014

    Posted 15 Jul 2014 Link to this post

    I am preparing to Update the database from a Telerik Data Access Model I have designed and I do not want the tables created in the dbo Database schema.  How do I specify which schema I want the tables created in?  I saw some instructions for adding ALTER SESSION SET CURRENT_SCHEMA=<new schema> in the Init SQL field of the Connection Pool under Backend Configuration, but this command does not work for MS SQL 2008.  

    Thank you
  2. Boris Georgiev
    Admin
    Boris Georgiev avatar
    190 posts

    Posted 17 Jul 2014 Link to this post

    Hi David,

    The SQL which you point out is for Oracle, not for MS SQL. The Init SQL which you should set to use a default schema other than "dbo" in MS SQL is:
    ALTER USER yourUser WITH DEFAULT_SCHEMA = myschema;
    Unfortunately if you are using Windows Authentication this SQL will not work.

    There is a workaround - when you create a new Domain Class, you could change the schema for it from the Table Editor when you map the class to a new Table. You should have in mind that by default when you first map a class to a table, the Schema Name field is disabled, so you should map the class first, close the Table Editor and then open it again to edit the mapping.

    I hope that helps.

    Regards,
    Boris Georgiev
    Telerik
     
    OpenAccess ORM is now Telerik Data Access. For more information on the new names, please, check out the Telerik Product Map.
     
  3. DevCraft banner
Back to Top