SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 filter criteria issue for different filed
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

kond.mohan
Posting Yak Master

India
189 Posts

Posted - 07/24/2013 :  05:53:49  Show Profile  Reply with Quote
hi

I am executing query in ssms 2008. when I passing the filter(spart field) criteria I getting all the values for that field.
same is not reflected in the fkart case .

FKART(nvarchar(4),null)
spart(nvarcahr(2),null)

select a.spart,a.FKART from VBRK a LEFT JOIN TVFKT G1 ON a.MANDT = G1.MANDT AND a.FKART = G1.FKART AND G1.SPRAS = 'EN'
where a.SPART between '0' and 'z'
I got the out put like
spart fkart
70 ZDDS
99 ZSTO
20 ZDDS
10 zccn

SwePeso
Patron Saint of Lost Yaks

Sweden
30190 Posts

Posted - 07/24/2013 :  05:55:58  Show Profile  Visit SwePeso's Homepage  Reply with Quote
What is your issue? The query returns the result it is told to.



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 07/24/2013 :  05:59:34  Show Profile  Reply with Quote
you're not applying any filter on FKART so how do you expect it to show only filtered set as result?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

kond.mohan
Posting Yak Master

India
189 Posts

Posted - 07/24/2013 :  06:14:34  Show Profile  Reply with Quote
here I am passing spart value 0 to z but data is getting for all spart values.if I include fkart and passed 0 to z value same not reflected.

mohan
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

Sweden
30190 Posts

Posted - 07/24/2013 :  06:21:37  Show Profile  Visit SwePeso's Homepage  Reply with Quote
Yes, but you are using BETWEEN!
For you, it means ALL rows starting with a numeric zero (ascii 48) up to and including rows starting with z (ascii 122) will be included in your result.

Perhaps you should try to explain again what is wrong?



Microsoft SQL Server MVP, MCT, MCSE, MCSA, MCP, MCITP, MCTS, MCDBA

Edited by - SwePeso on 07/24/2013 06:22:12
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000