September 8, 2011 at 11:03 am
I should have three columns in custom export segment,fieldid and fieldpipedId.
Segment has segments it can have one, two or more numbers with a pipe.(3231(1segemnt),3232|3233(2 segments),3234|3235|3236 (3segemnts)
fieldPipedID and field id are dependent on segment
fieldid increments by 1 if there are no segments and it increments by2 if there is one segment and if there are two segments it increments by 2 etc.
I need something like this
Segment fieldid fieldpipedid
3231 1 1
3232|3233 3 2|3
3234 4 4
3235|3236|3237 7 5|6|7
Any ideas on what logic to include to accomplish this?
September 8, 2011 at 11:09 am
That might give you some ideas.
SELECT
T.name,
STUFF((
SELECT
',' + name
FROM
sys.columns C
WHERE C.object_id = T.object_id
ORDER BY
name
FOR
XML PATH('')
) , 1 , 1 , '') As Columns_
FROM sys.tables T
ORDER BY name
Let me know if you get stuck on something.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply