Set password for a SQL database ? [modified]
-
Hi. In MS Access we can set password for a database. Can we set password for a SQL database(*.mdf)? if so, could you please say How? Thanks in advance.
modified on Monday, September 28, 2009 11:21 PM
-
Hi. In MS Access we can set password for a database. Can we set password for a SQL database(*.mdf)? if so, could you please say How? Thanks in advance.
modified on Monday, September 28, 2009 11:21 PM
USE master
GoEXEC sp_addlogin NewUser, password, dbName
GoWhere
NewUser
is the User Name,password
is the user password, anddbName
is the name of the database that you want to add the user to. Or, if you are using Windows authentication, add users to roles in SSMS.I don't speak Idiot - please talk slowly and clearly I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury Driven to the arms of Heineken by the wife
-
USE master
GoEXEC sp_addlogin NewUser, password, dbName
GoWhere
NewUser
is the User Name,password
is the user password, anddbName
is the name of the database that you want to add the user to. Or, if you are using Windows authentication, add users to roles in SSMS.I don't speak Idiot - please talk slowly and clearly I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury Driven to the arms of Heineken by the wife
The above method is to add user login to the database. But the OP is asking to set user id and password to the .MDF file as we can do it for MS Access files. AFAIK, We cannot set user id and password to the database files(.MDF and .LDF).
-
The above method is to add user login to the database. But the OP is asking to set user id and password to the .MDF file as we can do it for MS Access files. AFAIK, We cannot set user id and password to the database files(.MDF and .LDF).
dotnet buddy wrote:
AFAIK, We cannot set user id and password to the database files(.MDF and .LDF).
Correct.
I don't speak Idiot - please talk slowly and clearly I don't know what all the fuss is about with America getting it's first black president. Zimbabwe's had one for years and he's sh*t. - Percy Drake , Shrewsbury Driven to the arms of Heineken by the wife