Cannot Log into SQL Instance via SQLCMD

  • I have inherited a SQL 2008 R2 server that has a few instances of SQL Server on it. The DBA who knew the SA password left long before I arrived. Fortunately there were others who still had access to the default instance so I'm good there. There is another instance that is used for reporting that no one can log into with sysadmin access. So I'm trying to log in via SQLSMD to create an SA account for this instance but each time I do it creates the login under the default instance and not the named instance I'm telling SQLCMD to use.

    Here's what I do.

    sqlcmd -s servername\instance name

    I then add a new login like this:

    CREATE LOGIN recovery WITH PASSWORD = ‘password′

    GO

    The problem is it adds this login only to the default instance and not the instance in which I need to access.

    I've tried:

    sqlcmd -sservername\instance name

    and this...

    sqlcmd -s instance name

    and this...

    sqlcmd -s 'servername\instance name'

    but none will log into this instance name....and yes I am spelling the instance name correctly. It seems like SQLCMD only reads to the "\".

    I'm hoping to be able to recover this instance otherwise I will have to completely rebuild it. What am I doing wrong?

  • are you using "S" or "s"

    case matters...

    sqlcmd -S server\instance

    ---------------------------------------------------------------
    Mike Hahn - MCSomething someday:-)
    Right way to ask for help!!
    http://www.sqlservercentral.com/articles/Best+Practices/61537/
    I post so I can see my avatar :hehe:
    I want a personal webpage 😎
    I want to win the lotto 😀
    I want a gf like Tiffa :w00t: Oh wait I'm married!:-D

  • That did it!

    Thanks!

Viewing 3 posts - 1 through 2 (of 2 total)

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