Solved

RE : SQL Server query 2008

Posted on 2013-05-15
2
159 Views
Last Modified: 2013-05-20
Hi,

Database is SQL Server 2008 R2

I have one table named as Merchant having 3 columns
1) id(Auto increment),
2) Merchantid GUID
3) Name Nvarchar(100)

Whenever i do a search through query it never check the space on right as per below query it should not return any result because there is no space in my values. Values Store are like
5DE04B89-0893-40E8-9918-38A66DC256FD
Widget Test Merchant


select * from MERCHANT where
MERCHANTID='5DE04B89-0893-40E8-9918-38A66DC256FD    '
Return correct results

select * from MERCHANT where
MERCHANTID='5DE04B89-0893-40E8-9918-38A66DC256FDtest123 '
Return correct results

select * from MERCHANT where name='Widget Test Merchant      '
Return correct results

Let me know what is the issue or SQL server 2008 behave like that.
0
Comment
Question by:vikalgupta
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 40

Accepted Solution

by:
lcohan earned 500 total points
ID: 39168300
Yes, since 2008 looks like trailing spaces are ignored in SQL:

"Trailing spaces are ignored in SQL Server 2008"
http://www.codeproject.com/Tips/215593/Trailing-spaces-are-ignored-in-SqlServer-2008

Maybe check ANSI_PADDING settings in your SQL:

http://decipherinfosys.wordpress.com/2007/02/15/ansi_padding-and-trailing-spaces-in-sql-server/
0
 

Author Closing Comment

by:vikalgupta
ID: 39183466
Thanks
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There have been several questions about Large Transaction Log Files in SQL Server 2008, and how to get rid of them when disk space has become critical. This article will explain how to disable full recovery and implement simple recovery that carries…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question