Illegal Sql : select b.media_id,a.src_id,a.art_id,a.art_type,b.pub_id, b.cat_id ,b.pub_main_id,b.pub_mode,b.pub_insdate,b.pub_pubdate,b.pub_socialmedia,b.pub_priority,a.ART_AUTHORS,a.art_title as art_main_title,(case when a.art_listtitle is null then a.art_title else a.art_listtitle end) as art_title,(case when a.art_title_seo is null then a.art_title else a.art_title_seo end) as art_title_seo,a.ART_SUBTITLE,a.ART_HEADTITLE,a.art_summary,a.art_include,a.ART_MORE,a.ART_MORE_URL,b.PBT_ID,b.ost_id,b.PUB_RATINGAVG,b.pub_ratingsum,b.pub_ratingcount, b.PUB_ALLOWCOMMENT, b.PUB_VIEWSCOUNT,b.PUB_VIEWSCOUNTABSOLUTE, b.PUB_COMMENTSCOUNT,b.PUB_UPDATEDATE,b.pub_actualexpdate,b.pub_expdate,pubc.media_id as mediacopyid,pubc.cat_id as catcopyid,a.art_update,a.ART_TAG,b.pub_sharecount from publication b inner join article a on b.art_id=a.art_id left outer join publication pubc on b.pub_main_id=pubc.pub_id where b.cat_id=41589 and ( (b.ost_id=1 and isnull(b.pub_expdate, getDate()+1)>=getDate() and b.pub_pubdate<=getDate()) or b.ost_id=9 or b.ost_id=10) order by b.pub_pubdate desc || ERROR DESCRIPTION :Transaction (Process ID 89) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction. , -2147467259 Connection : Provider=SQLOLEDB.1;Password=per!pter@$21;Persist Security Info=True;User ID=web;Initial Catalog=auto_cont;Data Source=dbeditsql.internal.numatek.netuse.gr;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=WIN-UF3072K14B9;Use Encryption for Data=False;Tag with column collation when possible=False