Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Breaking up text sting into individual records

Author  Topic 

domo
Starting Member

23 Posts

Posted - 2007-11-01 : 05:50:53
Hi! Post #1 of many!

We're using a CRM tool which allows multiple assignees/departments per an individual ticket. Unfortunatley the multiple assignees/depts are stored as a text string in s single field. E.g: Users 'XX9999', 'AB1234' and departmet 'IT Dept' would look like this:

XX9999 AB1234 IT__bDept

As you can see, the UserIDs/depts are seperated by a space - so this will act as the delimiter. The __b acts as a space within the UserID/Dept name (which is generated by Perl I think).

What I need to do is insert each UserID into its own row in a new table as well as the corresponding ticket ID. I assume I will need to write a trigger but its the delimiter part I'm stuck on!

Any advice would be more than welcome!

Thanks.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-11-01 : 05:54:31
you can use substring() with charindex etc to split the content out.


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -