hhow to display the date [Resolved]

Posted by Rimjhim4 under Sql Server on 2/16/2012 | Points: 10 | Views : 1079 | Status : [Member] | Replies : 7
i have an emp table,in this table i have 51 column, in this table one column is hiredate, in result i want
to display all record but in the hiredate column i want to display the
date in dd/mmm/yyyy format
how it possible pls tell me with query in sql server???????????
what is the query for this???????




Responses

Posted by: Sksamantaray on: 2/17/2012 [Member] Silver | Points: 50

Up
0
Down

Resolved
I think you want to display all columns ,but your hiredate column should have specific format.


select *,HiredDate=convert(varchar(20),hiredate,106)
into #temp from YourTableName
alter table #temp drop column hiredate
Select * from #temp
drop table #temp


Thanks,
Sanjay

Rimjhim4, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Pradeepkumar417 on: 2/16/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,

You can get the date by using below query.

select convert(varchar(20),GetDate(),103)

Thanks & Regards,
Software Engineer,
Pradeep Kumar

Rimjhim4, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rimjhim4 on: 2/16/2012 [Member] Starter | Points: 25

Up
0
Down
pls read the question carefully i want to display all records in one query with changing date format..........
i can not write 51 column name in my query..............

Rimjhim4, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Naraayanan on: 2/16/2012 [Member] Starter | Points: 25

Up
0
Down
Hi,
Check this link
http://www.technoreader.com/SQL-Server-Date-Time-Format.aspx
Try this
SELECT CONVERT(VARCHAR(12), ColumnName , 107) AS [DD-Mon-YYYY]


Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/

Rimjhim4, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rimjhim4 on: 2/16/2012 [Member] Starter | Points: 25

Up
0
Down
pls read the question carefully i want to display all records in one query with changing date format..........
i can not write 51 column name in my query..............

Rimjhim4, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Rimjhim4 on: 2/17/2012 [Member] Starter | Points: 25

Up
0
Down
is this a single query or more than one query
pls mention numbering also

Rimjhim4, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sksamantaray on: 2/17/2012 [Member] Silver | Points: 25

Up
0
Down
keep it inside a procedure

Thanks,
Sanjay

Rimjhim4, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response