FN_Split() Table Valued Function by SQL Instructor Jeff Jones

Home > Blogs > SQL Server > FN_Split() Table Valued Function by SQL Instructor Jeff Jones

FN_Split() Table Valued Function by SQL Instructor Jeff Jones

Like This Blog 0Jeff Jones
Added by December 8, 2007

Fn_Split()

The link above is to a file with a table-valued function called fn_split(). This function allows you to pass a string of values to an IN clause of a SQL query. It breaks them down into a set of rows in a virtual table. Then you use a subquery in the IN clause.

This function is very useful when passing multi-valued parameters in a SQL Server Reporting Services report into a stored procedure.  The parameter is defined in the stored procedure as a large varchar string (max 8000 character).  In the stored procedure you would reference the function in the WHERE clause where you  want to use the multiple parameter values.

Example:

SELECT *
FROM table
WHERE column IN (SELECT [value] FROM dbo.fn_split(@parameter, ','))

You may also like:  Microsoft White Paper - SQL Server 2016 and Windows Server 2016 Better Together

Videos You May Like

Agile Methodology in Project Management

0 60 0

In this video, you will gain an understanding of Agile and Scrum Master Certification terminologies and concepts to help you make better decisions in your Project Management capabilities. Whether you’re a developer looking to obtain an Agile or Scrum Master Certification, or you’re a Project Manager/Product Owner who is attempting to get your product or … Continue reading Agile Methodology in Project Management

How to clone a Windows Server 2012 or 2012 R2 Domain Controller

1 437 2

One of the coolest new features in Window Server 2012 and Windows Server 2012 R2 is the ability to clone a Domain Controller. In the past, if we had virtualized Domain Controllers and we actually took a snapshot of it and then rolled back to that snapshot, it would break the logon service on that … Continue reading How to clone a Windows Server 2012 or 2012 R2 Domain Controller

Detailed Forensic Investigation of Malware Infections – April 21, 2015

2 192 1

In this IT Security training video, Security expert Mike Danseglio (CISSP / CEH) will perform several malware investigations including rootkits, botnets, viruses, and browser toolbars.

Write a Comment

Share your thoughts...

Please fill out the comment form below to post a reply.