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 3311634
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:54:00+00:00 2026-05-17T21:54:00+00:00

I have a table with varbinary(max) column and nvarchar(max) column. One of them is

  • 0

I have a table with varbinary(max) column and nvarchar(max) column. One of them is null and the other has a value.

I would like to return the column that has the value as a varbinary(max) column. So far I have tried this, that does not work:

SELECT 
      A =  
      CASE A
         WHEN NULL THEN B
         ELSE A 
      END
FROM Table
  • 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-05-17T21:54:01+00:00Added an answer on May 17, 2026 at 9:54 pm
    SELECT COALESCE(A, CAST(B As varbinary(max)))
    

    UPDATE: In response to comments (thanks) and assuming B is the nvarchar(max) column, I have moved the CAST inside the COALESCE

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

Sidebar

Related Questions

SSRS newbie question here... I have a table where one column is varbinary(max) data.
I have a table in which there is one column named: 'eZip' (varbinary(5), null).
I have a table with a varbinary(max) column for an image. I have dropped
I have a table which has an IDENTITY field and a VARBINARY(MAX) field in
I have a table with a 'Wav' column that is of type 'VARBINARY(max)' (storing
I have following table CREATE TABLE User ( email sysname NOT NULL, sign varbinary(256)
I have a large varbinary field in one of my tables, and I would
I have a table with a VARBINARY(MAX) field (SQL Server 2008 with FILESTREAM )
I save my long value in a SQL Server table as varbinary(max) : var
I have an entity with a binary datatype and a corresponding varbinary(max) column in

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.