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
 General SQL Server Forums
 New to SQL Server Programming
 Concat to create a date

Author  Topic 

crugerenator
Posting Yak Master

126 Posts

Posted - 2007-11-06 : 13:41:59
will this work to create a whole date if YEAR_OPENED is a solid year. Like 1957 for example?

org_date_founded = YEAR_OPENED+'01-01'

dinakar
Master Smack Fu Yak Hacker

2507 Posts

Posted - 2007-11-06 : 13:48:52
org_date_founded = Convert(Datetime,Convert(varchar,YEAR_OPENED) +'-01-01')

Dinakar Nethi
************************
Life is short. Enjoy it.
************************
http://weblogs.sqlteam.com/dinakar/
Go to Top of Page

crugerenator
Posting Yak Master

126 Posts

Posted - 2007-11-06 : 13:52:13
Nice, thanks. I thought it would be a little more complicated than that.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-11-06 : 13:53:06
[code]
DECLARE @YEAR_OPENED int
SET @YEAR_OPENED = 1957
SELECT DATEADD(Year, @YEAR_OPENED-1900, 0)
[/code]
Kristen
Go to Top of Page
   

- Advertisement -