Hi satabeach,
Refer below query.
SQL
DECLARE @Test AS TABLE(itId INT,itemName VARCHAR(20))
INSERT INTO @Test VALUES(1,'Apple')
INSERT INTO @Test VALUES(2,'pencil')
INSERT INTO @Test VALUES(3,'Mango')
INSERT INTO @Test VALUES(4,'pencil')
INSERT INTO @Test VALUES(5,'Banana')
INSERT INTO @Test VALUES(6,'')
INSERT INTO @Test VALUES(7,'Peach')
INSERT INTO @Test VALUES(8,'Stawbery')
SELECT * FROM @Test WHERE itId BETWEEN 3 AND 6 AND ISNULL(itemName,'') <> ''
Output
itId | itemName |
3 |
Mango |
4 |
pencil |
5 |
Banana |