Thanks Sean,
Please tell me if this is correct:
IF OBJECT_ID('TempDB..#tTestTB') IS NOT NULL
DROP TABLE #tTestTB
CREATE TABLE #tTestTB(
[VisOrder] [Int] NULL,
[ItemCode] [varchar](25) NULL,
[TreeType] [varchar] (1) NULL
)
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 0,'PA3922U-1ARA','N')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 1, 'MULTI-DOCK-BUNDLE1+','S')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 2, 'PA3934U-1PRP','I')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 3, 'PA3922U-1ARA','I')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 4, 'PL10436401','I')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 5, 'PL10436401-10pk+','S')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 6, 'PL10436401','I')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 7, 'MULTI-DOCK-BUNDLE3+','S')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 8, 'PA3934U-1PRP','I')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 9, 'PA3956U-1PRP','I')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 10, 'PL10436401','I')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 11, 'PA3922U-1ARA','I')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 12, 'PA1495U-1TWC','I')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 13, 'PA3945U-1EAB','I')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 14, 'PL10436401-2PK+','S')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 15, 'PL10436401','I')
INSERT INTO #tTestTB ( VisOrder,ItemCode,TreeType) VALUES ( 16, '920-003594','N')
SELECT * FROM #tTestTB
DROP TABLE #tTestTB
My Desire is to run this on a line by line basis.
When run against line 0 the result would be blank
Same for line 1
Line 2 - 4 would return 'MULTI-DOCK-BUNDLE1+'
Line 5 is blank
Line 6 Returns 'PL10436401-10pk+' despite line 4 containing the same information
Thank you for your help