?
Solved

RE : SQL Server query 2008

Posted on 2013-05-15
2
Medium Priority
?
160 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 1500 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 Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

I have written a PowerShell script to "walk" the security structure of each SQL instance to find:         Each Login (Windows or SQL)             * Its Server Roles             * Every database to which the login is mapped             * The associated "Database User" for this …
Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

762 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