“Cannot call methods on BIGINT” error

2019-09-05 06:32发布

问题:

I have a T-SQL query that I've been beating on for a while, it seems simple, but I get an error in the query designer when I try to execute it:

SELECT     Date, CAST(Date AS bigint) AS DateNum, Title, Earnings
FROM         dbo.Analysis_001

Whenever I try to execute/modify this in the designer, I get "Cannot call methods in BIGINT" as a pop-up error. Out of frustration, I tried executing it using "CREATE VIEW" and it worked... Why?

回答1:

It's a bug:

  • either in Management Studio - "Cannot call methods on bigint" error (Wayback Machine link),

  • or .Net SqlClient Data Provider - Stupid problem with BigInt converting!!!.

Related question: SQL Server Cannot Call Methods on Date