Solved

RE : SQL Server query 2008

Posted on 2013-05-15
2
153 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
2 Comments
 
LVL 39

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
In this article I will describe the Copy Database Wizard 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.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now