FUNCTION [dbo].[ActiveAccountStrings]
(
@pClientID varchar(50)
)
RETURNS varchar(255)
AS
BEGIN
declare @accounts int
declare @cnt int
declare @accountstring varchar(255)
declare @lastaccount varchar(50)
declare @lastaccountid int
declare @siteaddress varchar(255)
DECLARE @LINEBREAK AS varchar(2)
SET @LINEBREAK = CHAR(13) + CHAR(10)
select @accounts = count(*)
from ppaccounts pp (nolock)
inner join tiebacks t (nolock) on t.tiebackid = pp.tiebackid and t.clientid = @pClientID
where pp.status = 'A'
select @cnt = 1
select @lastaccount = ''
select @accountstring = ''
select @lastaccountid = -1
while (@cnt <= @accounts)
begin
select @lastaccount = min(pp.account)
from ppaccounts pp (nolock)
inner join tiebacks t (nolock) on t.tiebackid = pp.tiebackid and t.clientid = @pClientID
where pp.status = 'A' and pp.id > @lastaccountid
select @lastaccountid = pp.id
from ppaccounts pp (nolock)
where pp.account = @lastaccount
select @siteaddress = pp.ppsiteaddress
from ppaccounts pp (nolock)
where pp.account = @lastaccount
if @accountstring <> ''
begin
select @accountstring = @accountstring + @LINEBREAK + @lastaccount + ' - ' + @siteaddress
end
else
begin
select @accountstring = @lastaccount + ' - ' + @siteaddress
end
select @cnt = @cnt + 1
end
return @accountstring
END
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE