EDIT:
How to format a date in sql sevrer with format dd-mm-yyyy to format yyyy-mm-dd. This format is not given in sql server but similar format is available yyyy/mm/dd
Is it there any such function in sql server 2008 or 2005
EDIT:
How to format a date in sql sevrer with format dd-mm-yyyy to format yyyy-mm-dd. This format is not given in sql server but similar format is available yyyy/mm/dd
Is it there any such function in sql server 2008 or 2005
SELECT CONVERT(CHAR(10), GetDate(), 126)
By using CHAR(10), this will chop off the time portion, which you dont need.
ps. Replace GetDate() with the date you need converting
EDIT: Cast and Convert does show this conversion.
If you have a real "datetime" column, then the date is not stored in any particular string format but in a (fixed) binary format.
Only when displaying the results in Query Analyzer (or Management Studio) the internal format is converted into a string. If you query that column, you will get back a real date (not a string).