Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Comparing Dates in SQL Server

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-05-25 : 08:51:39
Sridhar writes "Hai,

I have a SQL Statement where the Records should be retrieved from a table which is stored in SQL Server. I am using VB.NET Windows Form to add conditions to the SQL Statement. Form contains two DatetimePicker Controls where user selects the Starting Date and Ending Date. In Oracle there is a To_Date format where we can convert a string date to specified format. But How can I Compare the dates in SQL Server when the date format is of any type in user's Regional Settings.

My SQL Statement is as follows:

SELECT Creation_Date
FROM PROPOSALS
WHERE Creation_Date >= " & FROMDTPICKER.VALUE & " AND Creation_Date <= " & TODTPICKER.VALUE & "

This is not giving me Exact Results. I tried it by writing a CONVERT FUNCTION. But of no use.

Please specify a standard format so that the results should be exactly matched irrespective of the system dateformat.

Thanks in Advance

Regards

Sridhar"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-05-25 : 09:27:25
Refer this
http://www.sql-server-performance.com/fk_datetime.asp

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -