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

  • Home
  • SEARCH
  • 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 9117501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:54:36+00:00 2026-06-17T04:54:36+00:00

I accidentally created a column with the wrong type NVARCHAR (for storing password salts)

  • 0

I accidentally created a column with the wrong type NVARCHAR (for storing password salts) and I want to convert it to NVARBINARY.

I tried

ALTER TABLE [dbo].[TableName]
    ALTER COLUMN [ColumnName] [varbinary] (20) NOT NULL
GO

but it says

Implicit conversion from data type nvarchar to varbinary is not allowed. Use the CONVERT function to run this query.

Is there a way to do that? CONVERT seems to be for expressions only, not for alterations.

  • 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-17T04:54:37+00:00Added an answer on June 17, 2026 at 4:54 am

    The only way by altering will be someting like:

    Create Table a (id int,blb Nvarchar(10))
    
    
    insert into a Values
    (1,'Test'),
    (2,N'Test2');
    
    BEGIN Transaction
    ALTER TABLE a
    ADD blb_New [varbinary] (20) NULL
    GO
    
    UPDATE a
    SET blb_new = CAST(blb AS varbinary(20))
    GO
    
    ALTER TABLE a
    DROP COLUMN blb
    GO
    
    EXEC sp_rename 'a.blb_new', 'blb', 'COLUMN'
    GO
    COMMIT Transaction
    
    
    Select *,CAST(blb as Nvarchar(20)) from a
    
    Drop Table a
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I created a table and accidentally created a column with the name DATE(FROM_UNIXTIME(email_sends.created_ts)) I
as i created my webpart project i accidentally entered a wrong URL to upload
I have created a table and accidentally put varchar length as 300 instead of
While attempting to create a replacement tablespace for USER, I accidentally created a datafile
I accidentaly created a table in PostgreSQL which contains, in its name, some double
I accidentally created a branch and pushed it to the origin. I created it
I seem to have accidentally created Visual Studio 2010 tab groups which means that
.NET newbie alert Using Visual C# 2008 Express Edition I have accidentally created a
Accidentally I have created file - (just a minus) in a directory and commited
A client of mine accidentally deleted about 500 records from an access table that

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.