all groups > sql server new users > january 2007 >
You're in the

sql server new users

group:

Convert csv to smalldate



Convert csv to smalldate SAC
1/31/2007 1:01:21 PM
sql server new users: Convert text to smalldate.

I have a text field which is formatted as yyyymmdd and I'd like to convert
it to a smalldate.

For example, I need 20070116 to become a smalldate field which would display
01/16/2007

How do I do this?

Then I want to add some days to a smalldate field

For example, I'd like to do [dbo].[tablename].shipdate + 3

Will this work?

Thanks for your help.




Re: Convert csv to smalldate Steve
1/31/2007 7:52:20 PM
[quoted text, click to view]


See SQL Server 2005 Books Online topics:
CAST and CONVERT (Transact-SQL)
DATEADD (Transact-SQL)


SELECT CONVERT(varchar(10),CONVERT(smalldatetime,'20070116'),101)
AddThis Social Bookmark Button