Basic Logics · Data Management · Real Scenario Logic's

Hyperlink a value in SQL Server

Introduction

In this blog post, we will see how to hyperlink a value in SQL Server. Additionally, we see how to interchange the value as normal link-text and hyperlinks.

Hyperlink a value

SQL Script

IF OBJECT_ID('Tempdb..#Temp') IS NOT NULL
	DROP TABLE #Temp;
GO

CREATE TABLE #Temp (NORMAL_LINK VARCHAR(200),HYPERLINK XML);
GO
INSERT INTO #Temp
SELECT 'https://arulmouzhi.wordpress.com/','https://arulmouzhi.wordpress.com/';
GO

SELECT 
NORMAL_LINK,
CAST(NORMAL_LINK AS XML) AS NORMAL_TO_HYPERLINK
FROM #Temp;
GO

Image Pic

Hyperlink a value

Interchange the value as Normal link-text and Hyperlinks

SQL Script

IF OBJECT_ID('Tempdb..#Temp') IS NOT NULL
	DROP TABLE #Temp;
GO

CREATE TABLE #Temp (NORMAL_LINK VARCHAR(200),HYPERLINK XML);
GO
INSERT INTO #Temp
SELECT 'https://arulmouzhi.wordpress.com/','https://arulmouzhi.wordpress.com/';
GO

SELECT 
NORMAL_LINK,
CAST(NORMAL_LINK AS XML) AS NORMAL_TO_HYPERLINK
FROM #Temp;
GO

SELECT 
HYPERLINK,
CAST(HYPERLINK AS VARCHAR(MAX)) AS HYPERLINK_TO_NORMAL
FROM #Temp;
GO

Image Pic

Interchange the value as Normal link-text and Hyperlinks

Conclusion

Thus, we saw one of the easiest way to hyperlink a value in SQL Server Using SSMS. Also, we saw how to interchange the value as Normal link-text and Hyperlinks. The above scripts are unit tested in both Azure SQL DB and On-Premises DB.

Related Blogposts

Follow Blog and Show your Support for many more interesting upcoming Posts!

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s