Can't create database RRS feed

  • Question

  • Hi

    I'm running VS 2010 with SQLExpress.

    I've set up a Silverlight Bussiness Application Solution and now I would like to set up my own database.

    Following this instruction ( http://msdn.microsoft.com/en-us/magazine/ee336128.aspx )   I'm trying to create a new database in the sqlexpress server.

    This ends up with the errror message "you are not allowed to create .... "

    I find now way to give me the permissions to set up databases. What is the problem.


    Can anyone help me?


    Thursday, July 8, 2010 4:16 PM

All replies

  • If you show the command that you used and the full error message, it would be helpful.  Things to check:

    1. Are you in the dbcreator fixed server role? If not, you need at least those rights.  Query would return 1 if you are:
           SELECT IS_SRVROLEMEMBER('dbcreator')

    2. Is there a server DDL trigger that someone wrote that is preventing the database creation? 

    Then there are other problems.  For example: Are you trying to create a database on a shared folder?  This is not allowed, although I do not think that it gives that error message.  And so on.


    Thursday, July 8, 2010 6:39 PM
  • Hi

    I am running vs2010.

    From "Data Model Designer" I start "Generate Database Wizard". 

    This gives me  MyModel.sql file.

    I open in a window an execute the command "Execute SQL"

    This gives the following error message:

    Msg 262, Level 14, State 1, Line 7

    CREATE TABLE permission denied in database 'master'.

    Msg 4902, Level 16, State 1, Line 7

    Cannot find the object "dbo.Entity1Set" because it does not exist or you do not have permissions.


    1.. this question returns 1

    2.. Not as I know of.







    Friday, July 9, 2010 8:06 AM
  • Apparently your script is not doing what you expected.   Please examine the script for:

    1 - Is there a "CREATE DATABASE dbname" command in it?   (If so, has the database been created on your server already?)

    2 - Is there a "USE dbname" in the script? (If so, does 'dbname' exist on your server?)  Can you switch your execution context from master to the target database?

    Your first error message is not complaining about creating a database, it is complaining that you are trying to create a table in the 'master' database.  Since you (properly) do not have rights to do this, you need to change the active database to 'dbname' (whatever that is) so that your script can run.

    Examine the script for the above.  It might be obvious. 

    If it is not, you might post the first 50 lines or so of the script, if you wish.  (If you do so, push the HTML button in the header of your next post, and paste the copied code into that.  It will help with formatting.)




    Friday, July 9, 2010 2:57 PM
  • Hi Lasse,

    I have found the following sentences in that link:

    First, I need to create the empty database to which I will apply the generated schema. To do this, I open Server Explorer, right-click on the Data Connections node and select Create New SQL Server Database (see Figure 4). With the empty database created, I right-click on the model design surface and select Generate Database from Model. Walking through the Generate Database wizard creates a BlogModel.edmx.sql file. With this new file open, it’s simple to right-click on the file and execute the SQL script to create the schema for my database.

    In other words, if we want to generate database before the step of "Generate Database Wizard".

    Therefore, I recommend that you create database before this step.

    If anything is unclear, please let me know.


    • Proposed as answer by Tom Li - MSFT Wednesday, July 14, 2010 1:22 AM
    Monday, July 12, 2010 11:56 AM
  • Hi Lasse,


    This ends up with the errror message "you are not allowed to create .... "

    Since you could not create database, this issue might be caused by insufficient privilege.


    In the situation of insufficient privilege, please log in SQL Server with a login which is member of sysadmin role then try again. Generally in the installation procedure of SQL Server, if you select “Windows Authentication mode” and click “add current user”, that user would have sufficient privilege to create a database. If you choose “SQL and Windows Authentication mode” and set a password, please log to SQL Server with login name of “sa” and password you have set before.



    I open in a window an execute the command "Execute SQL". This gives the following error message:

    As I said above, you might have insufficient privilege to create table in master database.

    I recommend that you use a login with sufficient privilege to create database and then execute generated script again.


    Meanwhile it is not recommended that create table in master database. It is recommended to create tables in a user database. In order to create tables in user database, please follow the steps below:

    1.       Open “SQL Server Management Studio”

    2.       Connect to specific instance

    3.       Open a new window

    4.       Switch to user database
    please execute the following statement to switch user database:
    USE <user database name>

    5.       Then copy script to this window and execute it again


    If anything is unclear, please let me know.

    Wednesday, July 14, 2010 2:15 PM