TSQL return value out of range
Declare @fromitem varchar(15), @toitem varchar(15)
set @fromitem=10
set @toitem=60
select categoryid,categoryno ,@fromitem , @toitem from category
where categoryno>=10 and categoryno<=60
thes must return categoryno between 10 and 60
but it return 1 and 2 and 3 and........
Why?
Categoryno varchar(15) becuase there is many items contains letters.
Help Please
Re: TSQL return value out of range
Quote:
Originally posted by fahedksa
Declare @fromitem varchar(15), @toitem varchar(15)
set @fromitem=10
set @toitem=60
select categoryid,categoryno ,@fromitem , @toitem from category
where categoryno>=10 and categoryno<=60
thes must return categoryno between 10 and 60
but it return 1 and 2 and 3 and........
Why?
Categoryno varchar(15) becuase there is many items contains letters.
Help Please
What you did was select everything where the categoryno was greater then or equal to 10 and where categoryno was less then or equal to 60
select categoryid,categoryno ,@fromitem , @toitem from category
where categoryno BETWEEN 10 AND 60
Will