Thursday, 17 August 2017

Searching With Date in Sql If FromDate And ToDate String

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)

No comments:

Post a Comment

React Hooks - custom Hook

  v CustomHook Ø React allows us to create our own hook which is known as custom hook. Example – 1 localStorage Demo Step-1 Create ...