I am running the below query in my code, but i am getting error as

Msg 102, Level 15, State 1, Line 3 Incorrect syntax near ')'.

Here is my query

"Select Type_desc, Type_Abbr from type_mst_a where Type_code = 'AC' and NOT Type_Abbr = 'PEC' " +
                                 "and type_abbr NOT IN (select category_id from EMP_ATTACHED_DOCUMENTS where " +
                                 "pk1_value = '" + txtEmpCode.Text + "')for xml raw,elements)) Categories"

Please suggest what is wrong here

where as my below query is working fine

select dbo.StringConcat((Select Type_desc from type_mst_a where Type_code = 'AC' " +
                                            "and type_abbr NOT IN (select category_id from EMP_ATTACHED_DOCUMENTS " +
                                            "where pk1_value = '" + txtEmpCode.Text + "')for xml raw,elements)) Categories"

Related posts

Recent Viewed