Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2006
    Location
    INDIA
    Posts
    94
    Thanks
    0
    Thanked 0 Times in 0 Posts

    insert / access MSSQL users from PHP

    Hi

    I am using MSSQL 2005 express edition and php 5.2.3.
    I would like to create system MSSQL users through php (just like sa user for example) for Authentication purpose. How to do that?
    Thanks in advance.
    -------------------------
    Shailesh Patil
    -------------------------

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Haven't used mssql in ages. Should be the same (similar) method to any other user creation, just gotta execute a query:
    CREATE USER user_name
    [ { { FOR | FROM }
    {
    LOGIN login_name
    | CERTIFICATE cert_name
    | ASYMMETRIC KEY asym_key_name
    }
    | WITHOUT LOGIN
    ]
    [ WITH DEFAULT_SCHEMA = schema_name ]

    Check in the database forum or search the net for mssql specific syntax (knowing MS, its probably different than most others). I got this from the ms tech site, so it should be somewhat close anyways.
    Oh, and this is a given, but you need to be a privileged user (Admin/root) to perform this, and generally, its unwise to connect to a database with administrative access to a database.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •