I’ve the following tables:
-
“procedures”:
code: bigint, primary key, auto-increment
caption: varchar(max), not-null
-
“worklist”:
code: bigint, primary key, auto-increment
title: varchar(max), not-null
procedures: varchar(max), not-null, comma-separated string of procedure-code
…
I’m using Linq-to-SQL to query the table “worklist” with column “procedures” to be translated to comma-separated string of procedure-caption.
e.g. the sub-query for “worklist”.”procedures”:
procedures = string.Join(",", (
from pc in w.procedures.Split(',').Select(cs => long.Parse(cs)).ToList()
join ps in db.procedures.AsEnumerable() on pc equals ps.code
select ps.caption
).ToArray()),
However, I’m facing the Exception of “Split() has no supported translation in SQL”.
Please kindly advise how to do that.
Many Thanks!
In the query you have shown, you will have to first fetch the records from db using linq query like:
or
now on abc you can use any of your string functions.. Because once you do ToList it will fetch the records from database.
Hope this Helps..