Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8532643
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:45:43+00:00 2026-06-11T09:45:43+00:00

I have a table TblUserLogin with columns LoginID int , Password varchar(50) , LoginUserName

  • 0

I have a table TblUserLogin with columns LoginID int, Password varchar(50), LoginUserName varchar(150), Designation varchar(100).

My requirement is that whenever we are using select statement to this table we are able to see the password which is entered (which is sensitive information).

Is there any way so that we can encrypt the password column so that when ever we use select statement that information will be seen in an encrypted way and will not affect the code which is accessing the password column or inserting new password?

In simple words when “The password column shown as encrypted when it is accessed from Management Studio using select statement, but when accessed programatically it returns the actual non-encrypted password”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:45:44+00:00Added an answer on June 11, 2026 at 9:45 am

    Try this:

    CREATE Procedure [dbo].[EncryptPasswd]
    @user_id int,
    @username varchar(255),
    @passwd varchar(255)
    As
    Begin
    Declare @res varbinary(2000)
    
    IF NOT EXISTS(select * from sys.symmetric_keys where name='##MS_DatabaseMasterKey##')
    CREATE MASTER KEY ENCRYPTION
    BY PASSWORD = 'xyz@123'
    
    
    IF NOT EXISTS(select * from sys.certificates where name='EncryptTestCert')
    CREATE CERTIFICATE EncryptTestCert
    WITH SUBJECT = 'xyz@123'
    
    IF NOT EXISTS(select * from sys.symmetric_keys where name='TestTableKey') 
    CREATE SYMMETRIC KEY TestTableKey
    WITH ALGORITHM = TRIPLE_DES ENCRYPTION
    BY CERTIFICATE EncryptTestCert
    
    OPEN SYMMETRIC KEY TestTableKey DECRYPTION
    BY CERTIFICATE EncryptTestCert
    
    
    INSERT INTO Users(user_id,username,passwd) 
    SELECT @user_id,@username,ENCRYPTBYKEY(KEY_GUID('TestTableKey'),@passwd)
    END
    

    Use this sproc whenver you insert a new user into your user table.So this will encrypt the password and insert.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table with column Percentage varchar(10) Data in that table is Pecentage 2/10
I have table with two columns (varchar from, varchar to). This table represents connections
I have a table called tblUserLogin. One of the columns is labeled UserID. Evertime
I have table with around 70 000 rows. There is 6000 rows that i
I have table of data that is sorted as follows: Item | Sample |
I have table with 5 columns ------------------------------------------------------ |_id(mongo default)| link | name| street|zip |
I have table Players with columns: ID Name Points What is most efficient way
I have table in an MS Access database that looks like this: ID Symbol
I have table of data that I am attempting to use lattice in R
I have table (call it my_table ) that can be simplified like this: NAME,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.