Msg 911, Level 16, State 1, Line 1 Database 'databasename' does not exist. Make sure that the name is entered correctly.

  • Dear All,

    Would anyone be able to let me know how to resolve the following error message please?

    Msg 911, Level 16, State 1, Line 1

    Database 'databasename' does not exist. Make sure that the name is entered correctly.

    Thank you in advance!

  • A bit more information would be helpful such as the background in which this error occurred.

    We can only help with the information presented to us.

    :exclamation: "Be brave. Take risks. Nothing can substitute experience." :exclamation:

  • tt-615680 (5/1/2012)


    Dear All,

    Would anyone be able to let me know how to resolve the following error message please?

    Msg 911, Level 16, State 1, Line 1

    Database 'databasename' does not exist. Make sure that the name is entered correctly.

    Thank you in advance!

    Try replacing 'databasename' with whatever your database is actually called, in whatever code it was that you may or may not have executed, using whatever application, tool or utility it was that you used.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Phil Parkin (5/1/2012)


    tt-615680 (5/1/2012)


    Dear All,

    Would anyone be able to let me know how to resolve the following error message please?

    Msg 911, Level 16, State 1, Line 1

    Database 'databasename' does not exist. Make sure that the name is entered correctly.

    Thank you in advance!

    Try replacing 'databasename' with whatever your database is actually called, in whatever code it was that you may or may not have executed, using whatever application, tool or utility it was that you used.

    Yea, do "WHATEVER" Phil says....lol!! 😀

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

  • Run this query in your instance:

    select *

    from sys.databases

    where name = 'YourDatabaseName'

    Does that actually return a record? The error is clearly laid out: you don't have a database with that name. Check your spelling.



    Twitter: @SQLife
    Email: sqlsalt(at)outlook(dot)com

  • I'm getting the same error however I believe it is a syntax error. I am certain the database exist. I'm attempting to change the collation of the 'CFGMGR' database in the SQL server management studio, SQLQuery window. I even tried the following:

    select *

    from sys.databases

    where name = CFGMGR

    I keep the the CFGMGR underlined in red and when I execute, I get the "Invalid column name 'cfgmgr'.

    Ideas?

    Lar

  • You are missing the quotes round the value on the name = CFGMGR.

    select *

    from sys.databases

    where name = 'CFGMGR'

    _________________________________________________________________________
    SSC Guide to Posting and Best Practices

  • Thanks, that executes fine. However when I attempt to us the systax to change the collation, I still get the "Database 'CFGMGR' does not exist.

    Use master:

    Go

    alter database CFGMGR

    collate sql_Latin1_General1_CP1_CI_AS ;

    Go

    --Verify the collation settings.

    select name, collation_name

    From sys.databases

    where name = N 'CFGMGR'

    Go

  • Have you tried running the alter while in the database you are changing the collation?

  • Negative. And I would do that how?

    Nevermind, I'm already there.

    Thanks

  • To resolve the issue I simply had to find out what the Primary file was called and I eventually found out that the name of the Primary file was called the original Database name but with "_1" after it it was as simple as that.

    Thank you all for you help, much appreciated!

  • Thank you for your reply, I'm running the following sql permission query which works fine on all other servers, the only difference is that a few of the databases have on the server which I'm running the query from have "-" in their names e.g. "database-name"

    EXEC sp_MSforeachdb

    'USE ?

    insert into #temp

    select DB_NAME() AS DatabaseName,

    mp.type AS [AccountType],

    mp.name as Database_user,

    rp.name as DatabaseRole,

    rp.type_desc AS TypeDesc

    from sys.database_role_members drm

    join sys.database_principals rp on (drm.role_principal_id = rp.principal_id)

    join sys.database_principals mp on (drm.member_principal_id = mp.principal_id)

    order by database_user

    '

    select

    DatabaseName,

    AccountType,

    Database_user,

    DatabaseRole,

    TypeDesc

    from #temp

    When running the following query I'm able to get the database result without any issues:

    select *

    from sys.databases

    where name = 'database-name'

    Thank you!

  • tt-615680 (11/27/2015)


    Thank you for your reply, I'm running the following sql permission query which works fine on all other servers, the only difference is that a few of the databases have on the server which I'm running the query from have "-" in their names e.g. "database-name"

    EXEC sp_MSforeachdb

    'USE ?

    insert into #temp

    select DB_NAME() AS DatabaseName,

    mp.type AS [AccountType],

    mp.name as Database_user,

    rp.name as DatabaseRole,

    rp.type_desc AS TypeDesc

    from sys.database_role_members drm

    join sys.database_principals rp on (drm.role_principal_id = rp.principal_id)

    join sys.database_principals mp on (drm.member_principal_id = mp.principal_id)

    order by database_user

    '

    select

    DatabaseName,

    AccountType,

    Database_user,

    DatabaseRole,

    TypeDesc

    from #temp

    When running the following query I'm able to get the database result without any issues:

    select *

    from sys.databases

    where name = 'database-name'

    Thank you!

    Databases with a - in the name need to be surrounded with square brackets [], [database-name].

  • Lynn Pettis (11/28/2015)


    tt-615680 (11/27/2015)


    Thank you for your reply, I'm running the following sql permission query which works fine on all other servers, the only difference is that a few of the databases have on the server which I'm running the query from have "-" in their names e.g. "database-name"

    EXEC sp_MSforeachdb

    'USE ?

    insert into #temp

    select DB_NAME() AS DatabaseName,

    mp.type AS [AccountType],

    mp.name as Database_user,

    rp.name as DatabaseRole,

    rp.type_desc AS TypeDesc

    from sys.database_role_members drm

    join sys.database_principals rp on (drm.role_principal_id = rp.principal_id)

    join sys.database_principals mp on (drm.member_principal_id = mp.principal_id)

    order by database_user

    '

    select

    DatabaseName,

    AccountType,

    Database_user,

    DatabaseRole,

    TypeDesc

    from #temp

    When running the following query I'm able to get the database result without any issues:

    select *

    from sys.databases

    where name = 'database-name'

    Thank you!

    Databases with a - in the name need to be surrounded with square brackets [], [database-name].

    This means you should enclose all your database names in square brackets or use the QUOTENAME function around them.

  • tt-615680 (5/1/2012)


    Dear All,

    Would anyone be able to let me know how to resolve the following error message please?

    Msg 911, Level 16, State 1, Line 1

    Database 'databasename' does not exist. Make sure that the name is entered correctly.

    Thank you in advance!

    It probably means permission issue. Where this error comes from and how do you check for that database name?

Viewing 15 posts - 1 through 14 (of 14 total)

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