How can u convert the Date to String?

Answer Posted / rajesh ranjan

select cast(getdate() as varchar)

select convert(varchar,getdate(),101)-mm/dd/yyyy
select convert(varchar,getdate(),102)-yy.mm.dd
select convert(varchar,getdate(),106)-ddmmyy
select convert(varchar,getdate(),108)-hh:mm:ss

etc.

Is This Answer Correct ?    18 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to enter date and time literals in ms sql server?

678


tell me what are the steps you will take to improve performance of a poor performing query? : Sql server database administration

749


How to create new tables with "create table" statements in ms sql server?

756


What is difference between view and materialized view?

699


List out the differences between global and local temp tables in sql server?

745






What is the Control Flow in SSIS

776


What are the different types of cursor?

811


Do you know what is a trace frag? Where do we use it?

716


How to update values in a table with update statements in ms sql server?

735


what is checksum in sql server.........???

1374


Is sql server a database?

692


Mention the differences between substr and charindex in sql server.

696


what is a default tcp/ip socket assigned for sql server? : Sql server database administration

756


What is the difference between ddl,dml and dcl commands?

810


What do you understand by triggers?

684