transforming numeric data to "date" type

By watergrl ·
Does anyone know if it is possible to convert a numeric field to a date field?

The data is stored in 4 individual fields(CC,YY,MM,DD).

I'm working with a user defined database table in Transact-SQL on MS SQL Sever 2000.

If so, how?

Thanks in advance.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

A few ways

by Tony Hopkinson In reply to transforming numeric data ...

Here's a quick one, this is based on CC being 20

Select Convert(DateTime,Convert(VarChar(8),((20 * 100 + YY) * 100 + MM) * 100 + DD)
From SomeTableOrOther

Slightly sneaky , but otherways would require a lot of typing.

Related Discussions

Related Forums