R
rodchar
hi all,
i have this dynamic cte sql statement that i'm building with a
StringBuilder. It is a very lengthy sql statement (70 lines of code). So at
different places in the sql string i have these conditional statements for
variability. For instance, at runtime a variable where clause can occur, or
multiple joins could be added, or even different fields can be selected. So,
then even more lines of code get added and less readable.
So I wanted to get some feedback on a direction i think may be more readable
but may degrade performance. i was thinking to put small place holders thru
out the string and then do all the conditioning below the statement and
replace the placeholders when i'm done. However, i've had to create more
instances of StringBuilder (about 5 new instances or more) objects just to
get it to work.
Now would the trade off be worth it (new instances of stringbuilder vs
readability) or are there any other ideas you know of (with the exception of
new technology like linq)?
thanks,
rodchar
thanks,
Now is the trade
i have this dynamic cte sql statement that i'm building with a
StringBuilder. It is a very lengthy sql statement (70 lines of code). So at
different places in the sql string i have these conditional statements for
variability. For instance, at runtime a variable where clause can occur, or
multiple joins could be added, or even different fields can be selected. So,
then even more lines of code get added and less readable.
So I wanted to get some feedback on a direction i think may be more readable
but may degrade performance. i was thinking to put small place holders thru
out the string and then do all the conditioning below the statement and
replace the placeholders when i'm done. However, i've had to create more
instances of StringBuilder (about 5 new instances or more) objects just to
get it to work.
Now would the trade off be worth it (new instances of stringbuilder vs
readability) or are there any other ideas you know of (with the exception of
new technology like linq)?
thanks,
rodchar
thanks,
Now is the trade