I have a table, in one of the fields I stored a string like this:
RMaster.dbo.fnFormatDate (GETUTCDATE(), 'Company_Enroll_YYYY-MM-DD.csv')
I would like to use it as part of the query that I could call from my c# code, so the query would look like this:
Select ThisField, …
From mytable
Is this doable?
Thanks.
Yes, just generate a SQL string by nesting.
EDIT
Here is one way to handle the multi-row scenario:
This produces an ugly union query:
You could probably build an awful and much more complicated
CASEexpression dynamically, but as long as there’s a good supporting index on ID so that each query is a single-row seek, this should be okay. The calls to the UDF are probably going to kill you more than the rest of the query anyway.