Monday, February 7, 2022

Date Formate In Sql server


Change custom date format in  sql query in ms sql server 

 format(top_update,'dd/MMM/yyyy') as top_updates



Examples 

select row_number() over(order by joinnow.top_update desc ) as row, user_id,sponser_id,f_name,mobile,email,telephone,format(top_update,'dd/MMM/yyyy') as top_updates,

(select address+' , '+(select districtname from districts where districtid=joinnow.districtid)+', '+(select statename from state_master where stateid=joinnow.stateid)+', Pincode- '+pincode) as address,

(select plan_name from plans where id=joinnow.package) as package,convert(varchar,edate,103) as edate,remark,

(select products from products where id=joinnow.product_id) as products,format(product_status_date,'dd/MM/yyyy') pp,

(case product_status when 0 then 'Pending' when 1 then 'Delivered' when 2 then 'Cancel' end) as status,product_status

from joinnow where product_id is not null and product_status=0 and top_up=1 and product_id != 0 order by top_update desc

No comments:

Post a Comment

Linq Expression syntax for where condtion in linq

(Expression<Func<T, bool>> filter)