dbTalk Databases Forums  

Using Between and Like together in the where clause

microsoft.public.sqlserver.mseq microsoft.public.sqlserver.mseq


Discuss Using Between and Like together in the where clause in the microsoft.public.sqlserver.mseq forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Wayne
 
Posts: n/a

Default Using Between and Like together in the where clause - 07-02-2009 , 02:18 PM






I have a SRS report that I am trying to run. The problem is that since it is
so large when I run the report in it's entirety, I can't export it out as a
PDF. I was wanting to see if I could use the like statement along with the
Betwen statement to allow the user to enter a range of last names ie. Between
Like @Beginning +'%' AND @End +'%' where the user could enter an "A" for
Beginning and "M" for end to get all lastnames beginning with A through M to
run the report in batches.
Thanks
--
Wayne Hess

Reply With Quote
  #2  
Old   
Hugo Kornelis
 
Posts: n/a

Default Re: Using Between and Like together in the where clause - 07-02-2009 , 05:26 PM






On Thu, 2 Jul 2009 12:18:14 -0700, Wayne wrote:

Quote:
I have a SRS report that I am trying to run. The problem is that since it is
so large when I run the report in it's entirety, I can't export it out as a
PDF. I was wanting to see if I could use the like statement along with the
Betwen statement to allow the user to enter a range of last names ie. Between
Like @Beginning +'%' AND @End +'%' where the user could enter an "A" for
Beginning and "M" for end to get all lastnames beginning with A through M to
run the report in batches.
Thanks
Hi Wayne,

To get all names that start with the letter A through M, use

WHERE Name >= 'A'
AND Name < 'N';

(or you can use BETWEEN 'A' AND 'MZZZZZZ', but that depends a bit on
collation settings and actual values in the column so it's slightly less
safe).

--
Hugo Kornelis, SQL Server MVP
My SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.