Getting date range data
I have a column TransationDate is decimal data type the data's like 20170121 I want to display data's in date range, The database columns data like 20170121 ..............20170129. I want to display data's these date range based on given strartdate,enddate as criteria. In my query it is displayed only one record. what's wrong my query could any body advise to me.declare @StartDate varchar(10)
declare @EndDate varchar(10)
set @StartDate ='20170121'
set @EndDate ='20170129'
SELECT *
FROM LCOM.dbo.PORCPAH PORCPAH
WHERE CONVERT(DATETIME, CONVERT(VARCHAR(8), PORCPAH.TRANSDATE), 112) >= @StartDate
AND CONVERT(DATETIME, CONVERT(VARCHAR(8), PORCPAH.TRANSDATE), 112) <= @EndDate