Rx_
Nothing In Moderation
- Local time
- Yesterday, 23:49
- Joined
- Oct 22, 2009
- Messages
- 2,803
The first time this code is run, there is an error message (See attachment).
After clicking OK, it just runs fine.
Is this error message normal?
There exist a table that takes a PK in one column, then Concats the (STIP abbreviation, start Day/MO, End Day/MO)
Sometimes, the PK had several STIP records.
The code below combines all of the STIPs in the same PK and Concats them with a comma to seperate them. (See Attachment)
This view is being consumed by another view.
The view that consumes this doesn't bring up this error message.
Some of the STIPS (e.g. PM) Don't have a date, so we see PM()
Once in a while, there is this extra close parens. No rhyme or reason.
After clicking OK, it just runs fine.
Is this error message normal?
There exist a table that takes a PK in one column, then Concats the (STIP abbreviation, start Day/MO, End Day/MO)
Sometimes, the PK had several STIP records.
The code below combines all of the STIPs in the same PK and Concats them with a comma to seperate them. (See Attachment)
This view is being consumed by another view.
The view that consumes this doesn't bring up this error message.
Code:
SELECT STIP2.[ID_Wells], substring
((SELECT ', ' + STIP1.[STIPwDate] AS [text()]
FROM [RegulatoryDB].[dbo].[vRegulatory_Nav_GIS_Stips] STIP1
WHERE STIP1.[ID_Wells] = STIP2.[ID_Wells]
ORDER BY STIP1.[ID_Wells] FOR XML PATH('')), 2, 1000) [STIPwDate]
FROM [RegulatoryDB].[dbo].[vRegulatory_Nav_GIS_Stips] STIP2
Some of the STIPS (e.g. PM) Don't have a date, so we see PM()
Once in a while, there is this extra close parens. No rhyme or reason.