.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Is this expected behavior, Less than equal to date.999 include next day

Posted By:      Posted Date: October 06, 2010    Points: 0   Category :Sql Server

Environment: SQL Server 2005 Express 9.0.4053


Scenario: selection of records based on datetime field in range >=begindate and <=enddate

where begindate = "01/01/2010 00:00:00" and enddate = "10/10/2010 23:59:59.999"


Expectation: the result set would only include records with a datetime value less than or equal to "10/10/2010 23:59:59.999"


Results: the result set returned includes records with a datetime value of "10/11/2010 00:00:00.000" (the next day)



Is this expected behavior?

May we all make money in the sequel.

View Complete Post

More Related Resource Links

Not Equal To Operator (<>) Behavior

Can someone explain this behavior with the <> operator when used along with a variable as opposed to a hard coded value. I'm totally confused (: Thanks for the help! -- Scenario 1: Value 3 is hard coded if object_id ('tempdb..#t') is not null drop table #t GO SET ANSI_NULLS OFF GO create table #t (c1 int null) insert into #t select 3 insert into #t select NULL SELECT * FROM #t WHERE c1 <> 3 -- 0 rows returned ---------------------------------------------------------------- ---------------------------------------------------------------- -- Scenario 2: Value 3 assigned to variable @a and used if object_id ('tempdb..#t') is not null drop table #t GO SET ANSI_NULLS OFF GO create table #t (c1 int null) insert into #t select 3 insert into #t select NULL declare @a int = 3 SELECT * FROM #t WHERE c1 <> @a -- 1 row returned with NULL value.. Why..?? ---------------------------------------------------------------- ---------------------------------------------------------------- -- NOTE: Both the queries ve the ANSI_NULLS OFF  

Displaying Date Field Base On Check Box Equal To Yes

In WSS 3.0 I am trying to display a date field on a form if a user selects (checks yes) in a check box field

Check either date greater than or equal to

How to check range using date i.e. suppose user pass date [Date].[Calendar Weeks].[Date].[February 21, 2003] and I want to compare that with another date either it is greater than or equal to then how to check that. 

Using a CompareValidator to check input is a valid date

The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

How To Set a Date Format In GridView Using ASP.NET 2.0

A very common desire is to set a column of a gridview to display just the month, day and year of a DateTime type. The problem is the by default, the HtmlEncode property of the boundfield attribute (
The problem is that if this field is enabled, you can not pass format information to the boundfield control. That is, if you try the following code, you will not get the desired result.

jQuery Date picker Implementation in ASP.NET

I've posted a wrapper ASP.NET around the jQuery.UI Datepickercontrol. This small client side calendar control is compact, looks nice and is very easy to use and I've added it some time back to my control library.

This is primarily an update for the jQuery.ui version, and so I spend a few hours or so cleaning it up which wasn't as easy as it could have been since the API has changed quite drastically from Marc's original implementation. The biggest changes have to do with the theming integration and the resulting explosion of related resources.

If you want to use this component you can check it out a sample and the code here:

Custom Editing Behavior for DataGridView TextBox Columns

For various reasons I'm using a DataGridView instead of a ListView, and while configuring the DataGridView to look like a ListView wasn't much of a problem, there's one thing that got on my nerves, which is the behavior of textbox cells in edit mode: It is much too easy to leave the edit mode accidentally, simply by pressing the cursor keys at the wrong time. For example when the text caret is positioned behind the last character of the textbox cell content, and you press the right arrow key

How to format datetime & date with century?

Execute the following Microsoft SQL Server T-SQL datetime, date and time formatting scripts in Management Studio Query Editor to demonstrate the usage of the multitude of temporal data formats available and the application of date / datetime functions.


Date and Time Functions in SQLSERVER

Date and time functions allow you to manipulate columns and variables with DATETIME and SMALLDATETIME data types.

1 DATEPART Function
2 DATENAME Function
3 DAY, MONTH, and YEAR Functions
5 DATEADD Functions
6 DATEDIFF Function
7 More SQL Server Functions

Data Types - Date and Time in SqlServer

Date and time values can be stored with either the DATETIME or SMALLDATETIME data type. The difference between the two is that SMALLDATETIME supports a smaller range of dates and does not give the same level of precision when accounting for time. The DATETIME data type can hold values from January 1st of 1753 to December 31st of 9999. The time is stored to the 1 three hundredths of a second and each value takes up 8 bytes of storage. The SMALLDATETIME data type can hold values between January 1st 1900 and June 6th of 2079. The time is tracked to the minute and each value takes up 4 bytes of storage. The majority of business applications can live happily with SMALLDATETIME, however, if you are in an environment where each second matters or you need to make estimates to the distant future (or past) then you have to resort to DATETIME. If you fail to specify the time when inserting a value into a DATETIME or SMALLDATETIME column, a default of midnight is used. If you fail to specify the date portion the default of January 1, 1900 is used.

Built-in Functions - Date and Time Functions

Date and time functions allow you to manipulate columns and variables with DATETIME and SMALLDATETIME data types.

Essential SQL Server Date, Time and DateTime Functions

The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any formatting considerations at all.

Date/Time Conversions Using SQL Server

There are many instances when dates and times don't show up at your doorstep in the format you'd like it to be, nor does the output of a query fit the needs of the people viewing it. One option is to format the data in the application itself. Another option is to use the built-in functions SQL Server provides to format the date string for you.

Date and Time Data Types and Functions

The following sections in this topic provide an overview of all Transact-SQL date and time data types and functions. For information and examples that are common to date and time data types and functions

SQL Server Date Formats

One of the most frequently asked questions in SQL Server forums is how to format a datetime value or column into a specific date format. Here's a summary of the different date formats that come standard in SQL Server as part of the CONVERT function. Following the standard date formats are some extended date formats that are often asked by SQL Server developers.

LocateSMS permitt to include your GPS-coordinates into a SMS

Summary: LocateSMS permitt to include your GPS-coordinates into a SMS

. Found under: SMS, GPS, navigation, coordinates

. Requirements:
Windows Mobile Pocket PC
GPS-antenna (wired, bluetooth, integrated, etc...)

ListViewControl - how to group items by their value, for eg. date range



I have a table containing courses, columns are 

Name - "Yoga Classes"

DateStart - "2/23/2010"

DateEnd - "2/24/2010"

I am using ListView Control to bind it, is there a way to display them and group them by Month? 

for eg.


Piano Class (10th Jan 2010 - 11th Jan 2010)
Guitar Class (10th Jan 2010 - 11th Jan 2010)


Yoga Class (15th Feb 2010 - 16th Feb 2010)

Thanks for help.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend