Skip to content

Instantly share code, notes, and snippets.

@dperussina
Created May 26, 2017 20:19
Show Gist options
  • Save dperussina/3d38765962e12ac6cf41daab9c65a431 to your computer and use it in GitHub Desktop.
Save dperussina/3d38765962e12ac6cf41daab9c65a431 to your computer and use it in GitHub Desktop.
Stuff((SELECT ' ' + B.reference
FROM tagnet_appointmentspn_partnerorderadditionalreferences B
WHERE B.partnerprimaryorderid = headers.partnerprimaryorderid
AND B.referencetype = 'CR'
AND LEFT(B.reference, 1) NOT IN ( '0', '1', '2', '3',
'4', '5', '6', '7',
'8', '9' )
FOR xml path('')), 1, 1, '') AS 'PARTNER NAME',
(SELECT addref2.reference from tagnet_appointmentspn_partnerorderadditionalreferences as addref2 where addref2.referencetype in ('cr')
and left(addref2.partnerprimaryorderid,1) not in ('0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9')) as 'PARTNER NAME',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment