dbTalk Databases Forums  

Parsing question

microsoft.public.sqlserver.dts microsoft.public.sqlserver.dts


Discuss Parsing question in the microsoft.public.sqlserver.dts forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mark
 
Posts: n/a

Default Parsing question - 10-14-2003 , 03:36 PM






I wish to parse a description field by the space between
each word and fit as many whole words into descr1, descr2,
descr3, and descr4 fields as possible.

Any suggestions?

CREATE TABLE [dbo].[ORDERS] (
[CATNO] [char] (20) ,
[DESCR] [char] (250) ,
[DESCR1] [char] (17) ,
[DESCR2] [char] (10) ,
[DESCR3] [char] (20) ,
[DESCR4] [char] (20) ,
)

INSERT INTO orders (catno, descr) VALUES('PHP-
43622422', 'QUARTZ BULB, 500 WATTS/125 VOLTS,
PHILIPS NO PHL-500T3Q/CL/P, 2000 HOURS')

Reply With Quote
  #2  
Old   
Allan Mitchell
 
Posts: n/a

Default Re: Parsing question - 10-15-2003 , 01:28 AM






I am not quite sure what you want but think you want to break each part of a
description out into seperate fields. Each part is delimited by a space ??

If yes then you can look into an ActiveX Script transformation and use the
VB SPLIT() function.

BTW Your design of table is odd.

You are potentially going to store the same info twice. You are also
potentially going to break 1st Normal Form. You are storing repeating
attributes. All CATNO attributes should have the same amount of DESCRn
attributes as every other.



--

----------------------------
Allan Mitchell (Microsoft SQL Server MVP)
MCSE,MCDBA
www.SQLDTS.com
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org



"Mark" <mark_d_thompson (AT) hotmail (DOT) com> wrote

Quote:
I wish to parse a description field by the space between
each word and fit as many whole words into descr1, descr2,
descr3, and descr4 fields as possible.

Any suggestions?

CREATE TABLE [dbo].[ORDERS] (
[CATNO] [char] (20) ,
[DESCR] [char] (250) ,
[DESCR1] [char] (17) ,
[DESCR2] [char] (10) ,
[DESCR3] [char] (20) ,
[DESCR4] [char] (20) ,
)

INSERT INTO orders (catno, descr) VALUES('PHP-
43622422', 'QUARTZ BULB, 500 WATTS/125 VOLTS,
PHILIPS NO PHL-500T3Q/CL/P, 2000 HOURS')



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.