Use Compare Validator if you are using asp.net
<asp:CompareValidator ID="cmvdate" Display="Dynamic" ErrorMessage="InvalidDate" SetFocusOnError="true"
runat="server" ControlToCompare="txt_DateFrom" ControlToValidate="txt_DateTo"
Operator="GreaterThanEqual">*</asp:CompareValidator> <asp:RegularExpressionValidator ID="RegularExpressionValidator1" ControlToValidate="txt_DateTo"
SetFocusOnError="true" Display="Dynamic" ValidationExpression="(([1-9]|1[012])[- /.]([1-9]|[12][0-9]|3[01])[- /.](19|20)\d\d)|((1[012]|0[1-9])(3[01]|2\d|1\d|0[1-9])(19|20)\d\d)|((1[012]|0[1-9])[- /.](3[01]|2\d|1\d|0[1-9])[- /.](19|20)\d\d)" ErrorMessage="Date" runat="server">*
if You want that in Sql Server
Check
declare @StartDate datetime, @EndDate datetime
if(@StartDate<@EndDate datetime)
begin
Your Code
end
else
Your Code
begin
end