简体   繁体   中英

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.

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

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

dbo.UKBN将是用户定义的函数

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM