conn = new SqlConnection("Data Source=PROJECTIDEAS\\SQLEXPRESS;Initial Catalog=Amruta_Ontology;Integrated Security=True"); conn.Open(); da = new SqlDataAdapter(); da.SelectCommand = new SqlCommand(); da.SelectCommand.Connection = conn; da.SelectCommand.CommandText = "with cte as (select Para_id,classname,COUNT(*) [cnt] from ClassClassificationgroup by Para_id,classname),cte2as(select Para_id,classname,ROW_NUMBER() over(partition by Para_id,classname order by cnt desc) rno from cte) update A set ClassName= B.classname from ParaClassification A inner join cte2 B where B.rno=1"; da.SelectCommand.CommandType = CommandType.Text; da.SelectCommand.ExecuteNonQuery();
↧
Incorrect syntax near the keyword 'by'. Incorrect syntax near the keyword 'where'.conn = new SqlConnection("Data Source=PROJECTIDEAS\\SQLEXPRESS;Initial Catalog=Amruta_Ontology;Integrated Security=True"); conn.Open(); da = new SqlD
↧