Skip to main content
added 105 characters in body
Source Link
ypercubeᵀᴹ
  • 98.6k
  • 13
  • 215
  • 305

If you use the >= and < operators you can return the required range by increasing"increasing the second argumentargument" by 1. Technically, replacing the last character ('5') with the next character ('6') in the character set.

Below is a query that returns all the rows in your range of A010 and A025. To get this I pass 'A026' as the second argument. The expression < 'A026' includes the value 'A0259456546'.

DECLARE @Test TABLE
(
    Val NVARCHAR(100)
) ;

INSERT @Test
VALUES ('A0004534543'), 
       ('A01034950834'), 
       ('A020043553'), 
       ('A0259456546'), 
       ('A0264565464') ;

SELECT  *

FROM    @Test

WHERE   Val >= 'A010' 
        AND Val < 'A026' ;

If you use the >= and < operators you can return the required range by increasing the second argument by 1.

Below is a query that returns all the rows in your range of A010 and A025. To get this I pass 'A026' as the second argument. The expression < 'A026' includes the value 'A0259456546'.

DECLARE @Test TABLE
(
    Val NVARCHAR(100)
) ;

INSERT @Test
VALUES ('A0004534543'), 
       ('A01034950834'), 
       ('A020043553'), 
       ('A0259456546'), 
       ('A0264565464') ;

SELECT  *

FROM    @Test

WHERE   Val >= 'A010' 
        AND Val < 'A026' ;

If you use the >= and < operators you can return the required range by "increasing the second argument" by 1. Technically, replacing the last character ('5') with the next character ('6') in the character set.

Below is a query that returns all the rows in your range of A010 and A025. To get this I pass 'A026' as the second argument. The expression < 'A026' includes the value 'A0259456546'.

DECLARE @Test TABLE
(
    Val NVARCHAR(100)
) ;

INSERT @Test
VALUES ('A0004534543'), 
       ('A01034950834'), 
       ('A020043553'), 
       ('A0259456546'), 
       ('A0264565464') ;

SELECT  *

FROM    @Test

WHERE   Val >= 'A010' 
        AND Val < 'A026' ;
added 61 characters in body
Source Link
ypercubeᵀᴹ
  • 98.6k
  • 13
  • 215
  • 305

If you use the >= and < operators you can return the required range by increasing the second argument by 1.

Below is a query that returns all the rows in your range of A010 and A025. To get this iI pass A026'A026' as the second argument. The expression < A0261 'A026' includes the value A0259456546'A0259456546'.

DECLARE @Test TABLE
(
    Val NVARCHAR(100)
) ;

INSERT @Test
VALUES ('A0004534543'), 
       ('A01034950834'), 
       ('A020043553'), 
       ('A0259456546'), 
       ('A0264565464') ;

SELECT  *

FROM    @Test

WHERE   Val >= 'A010' 
        AND Val < 'A026' ;

If you use the >= and < operators you can return the required range by increasing the second argument by 1.

Below is a query that returns all the rows in your range of A010 and A025. To get this i pass A026 as the second argument. The expression < A0261 includes the value A0259456546.

DECLARE @Test TABLE
(
    Val NVARCHAR(100)
)

INSERT @Test
VALUES ('A0004534543'), ('A01034950834'), ('A020043553'), ('A0259456546'), ('A0264565464')

SELECT  *

FROM    @Test

WHERE   Val >= 'A010' 
        AND Val < 'A026'

If you use the >= and < operators you can return the required range by increasing the second argument by 1.

Below is a query that returns all the rows in your range of A010 and A025. To get this I pass 'A026' as the second argument. The expression < 'A026' includes the value 'A0259456546'.

DECLARE @Test TABLE
(
    Val NVARCHAR(100)
) ;

INSERT @Test
VALUES ('A0004534543'), 
       ('A01034950834'), 
       ('A020043553'), 
       ('A0259456546'), 
       ('A0264565464') ;

SELECT  *

FROM    @Test

WHERE   Val >= 'A010' 
        AND Val < 'A026' ;
Source Link
James Anderson
  • 5.8k
  • 2
  • 26
  • 43

If you use the >= and < operators you can return the required range by increasing the second argument by 1.

Below is a query that returns all the rows in your range of A010 and A025. To get this i pass A026 as the second argument. The expression < A0261 includes the value A0259456546.

DECLARE @Test TABLE
(
    Val NVARCHAR(100)
)

INSERT @Test
VALUES ('A0004534543'), ('A01034950834'), ('A020043553'), ('A0259456546'), ('A0264565464')

SELECT  *

FROM    @Test

WHERE   Val >= 'A010' 
        AND Val < 'A026'