Open up your DBML (LINQ-to-SQL) file in an XML editor, go down to the end of the file and paste this just before the '</Database>' node:
<Function Name="ISNUMERIC" IsComposable="true">
<Parameter Name="Expression" Parameter="Expression" Type="System.String" DbType="NVarChar(4000)" />
<Return Type="System.Boolean" DbType="BIT NOT NULL"/>
</Function>
Now, you can use the already-in-SQL function called "ISNUMERIC". Here's how:
var blah = myDataContext.Accounts.Where(account=>
myDataContext.ISNUMERIC(account.ID) == true);
There you go :)
You may also find these functions useful to copy:
<Function Name="RAND" IsComposable="true">
<Return Type="System.Double" DbType="Float NOT NULL" />
</Function>
<Function Name="NEWID" IsComposable="true">
<Return Type="System.Guid" DbType="UniqueIdentifier NOT NULL" />
</Function>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…