You must Sign In to post a response.
  • Category: SQL Server

    How to protect database in sql server 2005

    how to protect database in sql server 2005 with the use of password
  • #767523
    when you install in your Sql Server 2005 there asking password for login . you should put there previously.

    otherwise follow this steps

    connect to DAC: sqlcmd -E -A -S .\EXPRESS or from SSMS use admin:.\EXPRESS
    run create login [machinename\username] from windows to create your Windows login in SQL
    run sp_addsrvrolemember 'machinename\username', 'sysadmin'; to make urself sysadmin member
    restart service w/o the -m -f

    refer this link

    Name : Dotnet Developer-2015
    Email Id

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #767530

    If you want to protect your database with Password, then In SQL Server side you just follow below syntax

    CREATE DATABASE "secure.sdf"
    DATABASEPASSWORD '<YourPassword>'

    If you want to set it from application wise then use Password property in connectionstring.

    "data source=\ssce.sdf; password=<YourPasswordHere>"

    If you want to know more details about this you may refer below link for more details, ""

    Give respect to your work, Instead of trying to impress your boss.

    Blog :

  • #767539
    what you mean by protection ? do you want to protect data or database file ? if you want to protect database file then you can go for following ways
    1- Encrypt outside SQLServer, before inserts and updates and decrypt after selects. ie: Using .net encryption. Downside: You loose some indexing and searching capabilities, cannot use like and betweens.

    2- Use third party tools (at io level) that block crud to the database unless a password is provided. ie: Downside: You will need to trust a third party tool installed in your server. It might not keep up with SQL Server patches, etc...

    3- Use an Auditing Solution that will keep track of selects, inserts, deletes, etc... And will notify (by email or event log)if violations occurred. A sample violation could be a dba running a select on your Salaries table. then fire the dba and change everyone salaries.

    Editor, DotNetSpider MVM
    Microsoft MVP 2014 [ASP.NET/IIS]

Sign In to post your comments