DECLARE @FromDate VARCHAR(50)='01/11/2016'
DECLARE @ToDate VARCHAR(50)='30/11/2016'
SELECT *
FROM TableName WHERE
CONVERT(DATE,CONVERT(VARCHAR,DateField,103),103) BETWEEN CONVERT(VARCHAR(10),
CONVERT(DATETIME,CONVERT(VARCHAR,@FromDate,103),103),121) AND CONVERT(VARCHAR(10),CONVERT
(DATETIME,CONVERT(VARCHAR,@ToDate,103),103),121)
DECLARE @ToDate VARCHAR(50)='30/11/2016'
SELECT *
FROM TableName WHERE
CONVERT(DATE,CONVERT(VARCHAR,DateField,103),103) BETWEEN CONVERT(VARCHAR(10),
CONVERT(DATETIME,CONVERT(VARCHAR,@FromDate,103),103),121) AND CONVERT(VARCHAR(10),CONVERT
(DATETIME,CONVERT(VARCHAR,@ToDate,103),103),121)
No comments:
Post a Comment