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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T04:40:43+00:00 2026-05-16T04:40:43+00:00

I just installed Microsoft SQL Server 2008 R2 to test with LINQ to SQL.

  • 0

I just installed Microsoft SQL Server 2008 R2 to test with LINQ to SQL.

I have a table with one column of type nchar(20) and two rows: ‘123’ and ‘Test’.

If I query all the rows from that table and wrap each value with “‘” I get the following:

'123 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ' ( _ is a space)

'Test _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ' ( _ is a space)

SQL Server seems to be filling the unused space (because the column is a 20 byte nchar) with spaces.

What can I do to prevent this from happening?

  • 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-16T04:40:43+00:00Added an answer on May 16, 2026 at 4:40 am

    Use nvarchar instead of nchar. nchar is a fixed width field that is filled with spaces, as you’re seeing.

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

Sidebar

Related Questions

i just installed sql server 2008 express in order to learn microsoft sql. why
I've just installed Microsoft SQL Server Express 2008 (with Reporting Services). My installation is
I have just installed Microsoft Robotics Studio 2008 R2, and I must admit that
i just installed the full sql server 2008 express on my machine and i
Basic Question - I have installed SQL Server Express 2008 with integrated SP1 .
I just installed SQL Server 2008 Express on my Vista SP1 machine. I previously
I have sql server 2008 R2 Express installed, but it seems the full text
Just this morning, I installed SQL Server 2008 Express SP2 from the Web Platform
I just installed SQL Server Express 2008 because of intellisense feature. It worked at
I have just installed SQL Server Compact Edition 4.0 on my Windows 7 machine.

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.