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?
CREATE FUNCTION [dbo].[JamieTestFunction]
(
)
RETURNS
@Requests TABLE
(
-- Make sure your type below is correct:
[RowNumber] int,
[ClientID] int,
[ClientName] NVARCHAR(200)
)
AS
BEGIN
INSERT @Requests
SELECT
ROW_NUMBER() OVER (ORDER BY ClientID) AS RowNumber,
ClientID,
ClientName
FROM clients
RETURN;
END
(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.)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.