T-SQL IsNumeric() and Linq-to-SQL

前端 未结 4 1924
再見小時候
再見小時候 2021-01-12 09:49

I need to find the highest value from the database that satisfies a certain formatting convention. Specifically, I would like to find the highest value that looks like

4条回答
  •  灰色年华
    2021-01-12 10:47

    My suggestion is to fall back to in-line SQL and use the DataContext.ExecuteQuery() method. You would use the SQL query you posted in the beginning.

    This is what I have done in similar situations. Not ideal, granted, due to the lack of the type-checking and possible syntax errors, but simply make sure it is included in any unit tests. Not every possible query is covered by the Linq syntax, hence the existence of ExecuteQuery in the first place.

提交回复
热议问题