I wanted to post this so that I won't forget how to fix it and also in case somebody else runs into the same issue.
In SQL Server 2005, I had a function that returned all records from a certain table:
SELECT * FROM Employees;
Best practices would be to not return all fields, but I don't care. I got the error:
View or function 'dbo.FunctionName' has more column names specified than columns defined.
I simply had to rebuild the function and all was well.
UPDATE: Sometimes this error is a lot harder to catch! Instead of getting the error, it was just shifting all the columns and so the values returning from the function were in the wrong columns! I think I better start specifying fields explicitly.
No comments:
Post a Comment