How can u convert the Date to String?

Answer Posted / samba shiva reddy . m

SELECT
GETDATE() AS UnconvertedDateTime,
CAST(GETDATE() AS nvarchar(30)) AS UsingCast,
CONVERT(nvarchar(30), GETDATE(), 126) AS UsingConvertTo_ISO8601 ;
GO
this will work for u try it out.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What happens if null values are involved in datetime operations?

539


Disadvantages of the indexes?

591


Where can you add custom error messages to sql server?

586


What happens if strings are casted into wrong code pages in ms sql server?

569


What are different types of database indexes?

535






What is change data capture (cdc) feature?

592


How to delete a database in ms sql server?

565


How to drop an existing stored procedure in ms sql server?

548


How do you rebuild an identity column?

552


How do clustered indexes store data?

618


How will you know when statistics on a table are obsolete?

611


How do you start single user mode in clustered installations?

525


When a primary key constraint is included in a table, what other constraints does this imply?

603


What is single-user mode and what are the steps you should follow to start sql server in single-user mode?

558


What is the difference between a "where" clause and a "having" clause?

623