Solved

RE : SQL Server query 2008

Posted on 2013-05-15
2
155 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

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…
SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

770 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