On 8 Mar 2005 06:14:40 -0800, hharry wrote:
(snip)
I have a varchar column which represents dates in YYYYMMDD and MM/DD/YY
formats.
Hi hharry,
That's a bad idea to start with. Please use a datetime column for dates.
If I query using:
SELECT MyDate FROM Table1
WHERE DOB LIKE '________'
Why aren't the dates in MM/DD/YY returned ? Is the / a special
character in T-SQL ?
What's in the DOB column? Your DDL includes only the MyDate column!
In case this is a type and you really meant
WHERE MyDate LIKE '________'
then I can't reproduce the problem:
-- Copied from your post
CREATE TABLE [dbo].[Table1] (
[MyDate] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS
NULL
) ON [PRIMARY]
GO
-- Inserted my own sample data
insert Table1 (MyDate) values ('20050308')
insert Table1 (MyDate) values ('08/03/05')
go
-- Copied from your post; changed DOB to MyDate
SELECT MyDate FROM Table1
WHERE MyDate LIKE '________'
go
-- Cleanup
drop table Table1
go
If I run the script above, both rows are returned.
Could you post some SQL to enable me to reproduce the problem on my
computer?
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)