...

View Full Version : insert / access MSSQL users from PHP



shaileshpatil
12-26-2007, 05:08 AM
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.

Fou-Lu
12-27-2007, 12:16 AM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum