var query2 = (from p in db.posts
where (p.date) == (from q in db.posts
select q.date).Max()
select p.date).SingleOrDefault();
id = Convert.ToInt32(query2);
I’m getting this error when trying to get the max Date from posts table, is there an alternative way?
TIMESTAMPis an internal SQL Server datatype stored as a 8-byte blob. It has nothing to do with date/time – it’s just an internal counter, really.It’s actually deprecated even – use the
rowversiondatatype instead (as of SQL Server 2008 and up).From SQL Server Books online:
You cannot use byte array bytes in aggregates, as the error message says clearly.
I would assume there is another
DATETIMEcolumn in your table somewhere??Check out this excellent Timestamps vs. Datetime data types article for more insights.
Marc