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.
Author |
Topic |
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2012-02-22 : 11:07:40
|
Hi All,I have one column DOJ and now i wanted to convert so that i can display the TenureYY:MM:DDPlease suggest |
|
DonAtWork
Master Smack Fu Yak Hacker
2167 Posts |
Posted - 2012-02-22 : 12:30:48
|
Display = front end. who cares what it looks like in the database.http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspxHow to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxFor ultra basic questions, follow these links.http://www.sql-tutorial.net/ http://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.asp |
|
|
X002548
Not Just a Number
15586 Posts |
|
sanjay5219
Posting Yak Master
240 Posts |
Posted - 2012-02-24 : 09:38:08
|
The data type is DateTime |
|
|
Jayam.cnu
Starting Member
45 Posts |
Posted - 2012-02-24 : 09:46:54
|
Then change it to Varchar and while inserting you can insert in that format only ..like convert(varchar,month(doj))+':'+convert(varchar,day(doj))+':'+convert(varchar,year(doj)).....i think there is not special datatype to change in that format... may we can create user defined datatypes to get that format... |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-02-24 : 09:58:31
|
quote: Originally posted by Jayam.cnu Then change it to Varchar and while inserting you can insert in that format only ..like convert(varchar,month(doj))+':'+convert(varchar,day(doj))+':'+convert(varchar,year(doj)).....i think there is not special datatype to change in that format... may we can create user defined datatypes to get that format...
Not at all a recommended approachas this makes date manipulations difficulttry to store them as date type itselfand in front end apply formatting functions to get it in way you need. All front end applications as well as reporting tools have such functions entirely for these purpose------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|