Saturday, 14 June 2014

Differents between Cast & Convert function in Sql Server

Ans:-

using Cast():-


select distinct cast(FromDate as Varchar) FromDate from tblmaster where mno=211

using Convert():-

select distinct Convert(Varchar,FromDate,103) FromDate from tblmaster where mno=211

using both cast() & convert():-

select distinct cast(Convert(Varchar,FromDate,103)as varchar) FromDate from tblmaster where mno=211

No comments:

Post a Comment