Hi,
I'm using SQL Server 2000
[u]First</u>
In SQL Query Analyser I'm trying to convert a TEXT field into DATE FORMAT. The data within the table field 'Movement Date' was imported into SQL via DTS and auto set the field to varchar(255). As the DTS will be a regular transfer occurence, can I change this in a query rather than alter the field datatype each time?
The current format is (for example):
'05-Feb-1999 00:00:00'
I need to convert to DD/MM/YYYY ('05/02/1999') - I'm not that concerned whether the trailing TIME is included or not.
I found that CDate (SQL Function) works in Access. However, when the following is code run in Query Analyser it complains that ''CDATE' is not a recognized function name.'
Code:
SELECT [Movement Header Number], CDATE([Movement Date]), [Load Quantity],
[Packaged Item Number], [Fixing Header Number] FROM dbo.progress_movhdr
[u]
Secondly</u>
I then need to test for date ranges (on 'Movement Date') in my query. Do I need to apply the 'BETWEEN' statement to test for a condition? Or a 'SELECT CASE'?
i.e.
If [Movement Date] >= 01/02/1999 AND
[Movement Date] <= 31/01/2000
The Dates are to be put in Year ranges and start around 1994.
Any ideas please?
Thanks in advance.
Neal
A Northern Soul