megaSteve4
megaSteve4

Reputation: 1760

explanation of SQL Server stored procedure / query

I was hoping someone could explain this snippet of a SQL Server 2005 stored procedure its part of a select query - I am competent in php mysql but ASP / SQL Server is not my forte!

+RTRIM(ISNULL(r.country,''))+'|'
+RTRIM(ISNULL(r.phone,''))+'|'
+RTRIM(ISNULL(r.fax,''))+'|'
+dbo.UKBN(RTRIM(ISNULL(r.bn,'')))+'|'
+RTRIM(ISNULL(r.bn,''))+'|'
+RTRIM(ISNULL(CAST (r.eventid AS varchar(5)),''))
)

I understand it takes db vars resets them if they are null to '' and trims them, then concatenates them together pipe separated.

This is the bit I don't get

+dbo.UKBN(RTRIM(ISNULL(r.bn,'')))+'|'

It seems to check if r.bn is null then resets to '' if so, then performs a trim, but then I do not understand what dbo.UKBN is / does????

It does not seem to be a table / var or another stored procedure - can someone explain what it is likely to be / do in this layout.

Upvotes: 3

Views: 387

Answers (3)

TehBoyan
TehBoyan

Reputation: 6890

dbo.UKIPBN is a user defined function. And it is scalar valued function. Try Programmability -> Functions -> Scalar-Valued Functions to find it.

Upvotes: 2

SliverNinja - MSFT
SliverNinja - MSFT

Reputation: 31641

dbo.UKBN would be a User-defined Function

Upvotes: 1

Martin Smith
Martin Smith

Reputation: 453287

dbo.UKIPBN is a scalar user defined function. In Management Studio look under Programmability -> Functions -> Scalar-Valued Functions to find it.

Upvotes: 6

Related Questions