dc

dc

  • NA
  • 663
  • 0

vb.net 2010 access sql

Aug 5 2016 12:01 PM

In an existing vb.net 2010 application that accesses a sql server 2012 datgabase, I only want to modify the exsiting sql to add a comment saying what
 cs.attributeID = 2775 and  cs.attributeID = 2771 means in the following sql right next to the line where the sql actually exists.

Const sql As String = "SELECT CS2775.Personid,SchoolYearValue,SchoolYearName,CS2775.StatusDateTime " _
          & " from  " _
          & "(SELECT cs.Personid,cs.value as SchoolYearValue, cd.name as SchoolYearName , [date] AS StatusDateTime  " _
          & " FROM TEST.DBO.customstudent cs WITH (NOLOCK)" _
          & " JOIN TEST.DBO.CampusDictiONary cd " _
          & "     ON cs.attributeid = cd.attributeID AND cs.value =cd.code" _
          & " WHERE cs.attributeID = 2775  " _
          & "  GROUP BY personID, cs.value, cd.value,name,[date]) as CS2775 " _
          & " LEFT JOIN (SELECT Personid,value as Edcounsel1CP, max([date]) AS StatusDateTime " _
          & "      FROM TEST.DBO.customstudent WITH (NOLOCK)" _
          & "         WHERE attributeID = 2771 " _
          & "  GROUP BY personID, value   ) as CS2771  " _
          & " ON CS2771.PersonID = CS2775.Personid " _
          & " AND CS2771.StatusDateTime = CS2775.StatusDateTime  " _
          & " WHERE CS2775.Personid = @studentlink ; "

I want to make this change since I am adding more 2 attribute values to an extensive long list of existing attribute values. Management would
not let me change the existing sql since it is not cost effective.

The only thing I know what to do is to place the comments prior to  the string assignment statement. Thus would you show me the code of how I can add
the comments I would like to place in the sql listed


Answers (1)