CREATE LOGIN command on named instance

  • Normally on a default instance of SQLServer, to create login from command prompt i use:

    USE master

    GO

    CREATE LOGIN [domainname\uname] FROM WINDOWS WITH DEFAULT DATABASE=master.

    But from command prompt I want to create the same login on a named instance INST1. If i run the same query, i am getting the error : Named pipes provide: Could not open a connection to SQL Server. A network-related or instance-specific error has occured. Check if instance name is correct.

    How to write in proper syntax. urgent please.

  • Chandu-212374 (10/23/2010)


    Normally on a default instance of SQLServer, to create login from command prompt i use:

    USE master

    GO

    CREATE LOGIN [domainname\uname] FROM WINDOWS WITH DEFAULT DATABASE=master.

    But from command prompt I want to create the same login on a named instance INST1. If i run the same query, i am getting the error : Named pipes provide: Could not open a connection to SQL Server. A network-related or instance-specific error has occured. Check if instance name is correct.

    How to write in proper syntax. urgent please.

    command prompt? Are you using SQLCMD to connect to the server and run this? If so, please see this link for how to properly specify a linked server with SQLCMD. (If you're using SQLCMD, you don't need the USE master - just use the "-d" parameter to specify the master database.)

    Why would you want to do this from a command prompt?

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

  • I guess you're running "standard install scripts" using sqlcmd.

    In your dos command just use:

    rem using windows authentication

    sqlcmd -Syourserver\yourinstance -E -s"create login ..."

    Check out SQLCMD in books online for all parameters and options

    Make sure your sqlbrowser is running, if not or you don't want to have sqlbrowser active, specify ",portnumber" in stead of the "\yourinstance".

    Be carefull if you use dynamic port numbers in your config settings.

    edited:

    This is the way we use our script library to install and config our standard stuff on any new instance:

    SQLCMD -E -S theserver\theinstance -d master -i "X:\SQLInventaris\installscripts\Grant showplan to uRole_RelMgr.sql" -o "X:\SQLInventaris\theserver_theinstance\Grant_Showplan.txt"

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

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

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