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 2000 Forums
 SQL Server Development (2000)
 help with splitting apart an array

Author  Topic 

lbodie
Starting Member

4 Posts

Posted - 2003-05-08 : 10:32:31
Can someone help me split an array out into new fields? Here is what I have:

table.field is a char[96] that contains 4 elements separated by ;
eg, 28.22;1.31;1.10;.20

I need to run some sort of update putting each of these values into their own field which has already been defined as a decimal field.

Thansk,

Larry

macka
Posting Yak Master

162 Posts

Posted - 2003-05-08 : 10:36:12
Take a look at [url]http://www.sqlteam.com/item.asp?ItemID=637[/url]

macka.

--
There are only 10 types of people in the world - Those who understand binary, and those who don't.
Go to Top of Page

lbodie
Starting Member

4 Posts

Posted - 2003-05-08 : 12:58:17
I need something like this...

UPDATE Order_Line_Invoice_Info
SET tax1 = CONVERT(decimal(18, 5), SUBSTRING(taxamount, 1, CHARINDEX(';', taxamount) - 1)),
tax2 = CONVERT(decimal(18, 5), SUBSTRING(taxamount, CHARINDEX(';', taxamount) + 1, CHARINDEX(';', taxamount, CHARINDEX(';', taxamount) + 1) - CHARINDEX(';', taxamount) - 1))

I don't know the syntax for tax3 and tax4.

Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-05-08 : 13:51:10
Look at this thread:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=24277

(it's a fun read ... some cool techniques in there as well)

- Jeff
Go to Top of Page
   

- Advertisement -