I have the following query (This is returned by tablevalued function)
SELECT
ROW_NUMBER() OVER (ORDER BY ClientHId) AS RowNumber,
ClientHId,
FirstName,
LastName,
FROM Client
Then I populate my dataset in SSRS like this:
select RowNumber,ClientHId,FirstName,LastName from fuctionClient
So far so good. Now, I am trying to use RowNumber column for sorting or displaying. If I try to sort, SSRS errors out says: "unsopported datatype exception" if I just try to show it in tablix it displays #error instead of rownumber. Visual Studio intellisense says that only integer, string, char… are supported. but Row_Number function returns integer! I was even trying to do cast as integer on rownumber but still does not help. Have anyone experienced the same problem? ClinetHid – HierarchyId
The dreaded “Could not reproduce.”
I just created a sample report with a query almost identical to yours, including creating a table-valued UDF and then calling that from the report. I then ordered the detail group by the RowNumber field without any problems. I made sure that I called the RowNumber field by the same name that you show above.
How do you declare the return datatype for that field in the UDF?
(Also, make sure that wherever you are specifying the RowNumber to use the Field!RowNumber.Value, not the built in RowNumber() function in SSRS, which may give different results. I doubt this is your problem though.)