I have a table in SQL Server with an entry that came from:
INSERT INTO table(data) VALUES CAST(getdate() AS BINARY(8))
I would like to do a LINQ query that will perform:
SELECT CAST(data AS DATETIME) FROM table
How can I accomplish this?
The datetime is stored as binary(8) in SQL Server for reasons beyond my control, and I need to retrieve the datetime.
You can use a model defined function to implement the CAST
http://msdn.microsoft.com/en-us/library/dd456857.aspx
See here for an analogous example:
Convert String to Int in EF 4.0