0

I'd like to have two columns show up that represent my extended properties. I was able to have one extended property showing column_description, but would like to include both extended properties with on left join.

I tried to make a case statement, but was unable produce two select statements

Left Join sys.extended_properties ep
    ON ep.main_id = originalfromcolumn
   And ep.secondary = origionalcolumnID
   and ep.name = 'description

Left Join sys.extended_properties ep1
    ON ep.main_id = originalfromcolumn
   And ep.secondary = origionalcolumnID
   and ep.name = 'document'

EDIT. so these two left joins give me what I want. But I want this from just one left join. Do I have to do a , left join case statement? my issue is I was ep which in my orginal select statement is a defined as a column. and ep1, which is also a specific column to appear. Im making a lot of left joins and as data comes in the loads will be slower if I keep left joining.

this will come up with a column description by using the extended properties, but I have another extended property I want to add within this left join and th ep.name is ep.documents.

I tried case statements, but it was not working. doesn anyon ehave code they used to accomplish this? Or will I have to make another left join?

Dave
  • 31
  • 2
  • 1
    Show us complete queries (perhaps simplified.) – jarlh May 29 '19 at 11:37
  • update your question add a proper data sample and the expected result (and all the sql code you are using) – ScaisEdge May 29 '19 at 11:42
  • If you do this in a single join you will end up with two rows from your `extended_properties` table for each row in your right-most table. So in order to do the single join and get similar results you will have to aggregate the columns in your left table. This may be more expensive then just doing two left joins. – JNevill May 29 '19 at 13:01

0 Answers0