Create Table Table_Name([Date] Varchar(100));
Standard 105.
Insert Into Table_Name Values('18-01-2015');
Insert Into Table_Name Values('19-01-2015');
Insert Into Table_Name Values('20-01-2015');
Insert Into Table_Name Values('21-01-2015');
Insert Into Table_Name Values('22-02-2015');
Insert Into Table_Name Values('22-03-2015');
Insert Into Table_Name Values('22-04-2015');
Insert Into Table_Name Values('22-05-2015');
Select [Date] From Table_Name Where [Date] >= '18-01-2015' And [Date] <= '20-01-2015'
Select [Date] From Table_Name Where [Date] Between '18-01-2015' And '22-01-2015'
Result is
Date
18-01-2015
19-01-2015
20-01-2015
21-01-2015
22-02-2015
22-03-2015
22-04-2015
22-05-2015
This is my C# Code that how I get date.!
label17.Text = DateTime.Now.ToString("dd-MM-yyyy"); If I try to insert it Date or Datetime datatype., the following error throws., Conversion failed when converting date and/or time from character string.
This is why I am supposed to use Varchar.
This is the query which I want.
SELECT * FROM Sundar_Tyre_Sale_Billing WHERE CONVERT(Date, [Date], 105) BETWEEN CONVERT(Date, '10-02-2015', 105) AND CONVERT(Date, '12-02-2015', 105) Order By [Date] ASC
Thanks everyone..!!