I have an SQL Query which extracts columns from a table that must be in this order
Item Id, Parms, Move list, MsgId. I also have a couple of requirements in the query that must remain there such as UserCode = automation and the Date is set to one day prior to the current day.
An example of the Parms output for one row is such
CURRENT OUTPUT
Parms:
V51370,Move List,M-000001
--
REQUIRED OUTPUT
Media: v51370
Comments: Was Removed From
Move List: M-000001
What I want to do is split this Parms column into two separate columns that are in between the Item Id and Move list Column. The first Column should be called Media which extracts the first six characters from the Parms Column:v51370. The second column is comments and if the MsgId is 1 the comment should be: Was Removed from.
Can Anyone make any suggestions to a possible query I could test? I'm not sure where to fit the Parms column split in there. That would be greatly appreciated.
Please Note: I am using SQL Server Management Studio 2008, and the table name is JnlList.
1 SAMPLE ROW (SELECT * FROM JNLLIST):
ItemId: 2
Date: 20122102.124652563
Object: S-000001
MsgID: 1
Parms: V86143,Scratch List,S-000001
Delimiter: -
UserCode: Automation
ActionId: 5
List Type: S