Phillip,
        You can nest a series of CASTs to do this.  It's not pretty, but 
it does work.  Here's my test script:

DECLARE @day int, @month int, @year int, @date datetime

SELECT @day = 11, @month = 9, @year = 2003
SET @date = CAST(CAST(@year AS varchar) + '-' + CAST(@month as varchar) + 
'-' + CAST(@day AS varchar) AS datetime)

PRINT @date

Thanks,
Eric




"Phillip B" <[EMAIL PROTECTED]>
09/11/2003 12:45 AM
Please respond to sql

 
        To:     SQL <[EMAIL PROTECTED]>
        cc: 
        Subject:        merge int fields into date


I am moving data from a poorly designed table to a new beter table. They
stored the date in the table in three int fields month, day, and year. I 
am
going to move the data to a new table with one field that is a date type.
How can I write the query to make the old ints into a date with out using
CF? I tried versions of this but none worked. select month + day+ year as
date
Man Im fried.

Phillip B.

www.LoungeRoyale.com
www.FillWorks.com


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/lists.cfm?link=t:6
Subscription: http://www.houseoffusion.com/lists.cfm?link=s:6
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=<:emailid:>.<:userid:>.<:listid:>

Get the mailserver that powers this list at 
http://www.coolfusion.com

                        

Reply via email to