2

I want to convert UniqueIdentifier value to string value so I can read it.

I am working SSRS Report where I have set datasource for one report. Now, ReportServer has one table named as DataSource and it has one column named as Link and its type is Link uniqueidentifier no 16.

Is it possible to convert this value into varchar()?

I have tried below but it gives same value.

--To fetch Link
SELECT ds.Link,CAST(ds.Link AS VARCHAR(36)) str
FROM   DataSource    AS ds
       JOIN CATALOG  AS c ON  c.ItemID = ds.ItemID
WHERE  c.Name = 'ReportName'

It gives output like this,

enter image description here

Note: I have already checked this, but doesn't helped me.

Community
  • 1
  • 1
Pedram
  • 6,256
  • 10
  • 65
  • 87

2 Answers2

1

A Guid/unique identifier generated by the system is (more or less) just a random string of characters. There's no encoded information you can extract, other than the type variant of the guid itself. That string is as readable as it's going to get.

Fiddles
  • 2,790
  • 1
  • 32
  • 35
0
--To fetch Link
SELECT ds.Link, CONVERT(VARCHAR(36), ds.Link) as str
FROM   DataSource    AS ds
       JOIN CATALOG  AS c ON  c.ItemID = ds.ItemID
WHERE  c.Name = 'ReportName'
gotnull
  • 26,454
  • 22
  • 137
  • 203
  • Gives same result. – Pedram Jun 10 '16 at 06:47
  • Still it gives same value, I have one question though, this Data-source table has Link column - data type is uniqueidentifier. Can we read it as string or not? – Pedram Jun 10 '16 at 06:53
  • It will just replace `-` with blank space what else it will do? I want to read the text of it. Like it should show `Reports/Datasourse/Name` – Pedram Jun 10 '16 at 07:02