Unix Technical Forum

Help parsing field

This is a discussion on Help parsing field within the SQL Server forums, part of the Microsoft SQL Server category; --> hi..i need help for my exam, I retrived data from my sms inbok and insert to table.The record just ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-01-2008, 03:04 PM
neolempires2@gmail.com
 
Posts: n/a
Default Help parsing field

hi..i need help for my exam, I retrived data from my sms inbok and
insert to table.The record just like this:
ID1,12x100,56x12,90x90..,how to pars the table in to:
ID First Second
ID1 12 100
ID1 56 12
ID1 90 90

Thank for your help...

===================

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 03-01-2008, 03:04 PM
markc600@hotmail.com
 
Posts: n/a
Default Re: Help parsing field

Using a table of numbers

http://sqlserver2000.databases.aspfa...ers-table.html


CREATE TABLE MyTable(ID VARCHAR(4), Data VARCHAR(100))
INSERT INTO MyTable(ID, Data) VALUES('ID1','12x100,56x12,90x90')

SELECT ID,
PARSENAME(REPLACE(Data,'x','.'),2) AS First,
PARSENAME(REPLACE(Data,'x','.'),1) AS Second
FROM (
SELECT ID,
SUBSTRING(Data ,
Number,
CHARINDEX(',' ,
Data+',' ,
Number)-Number) AS Data
FROM MyTable
INNER JOIN Numbers ON Number BETWEEN 1 AND LEN(Data)+1
AND SUBSTRING(','+Data,Number,1) = ',') X
ORDER BY ID


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 03-01-2008, 03:04 PM
neolempires2@gmail.com
 
Posts: n/a
Default Re: Help parsing field

you the best ,thx.
if data inserted to table about 100 data/sec,is the script run well in
this condition, and no data lost or error??

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 03-01-2008, 03:04 PM
Ed Murphy
 
Posts: n/a
Default Re: Help parsing field

neolempires2@gmail.com wrote:

> if data inserted to table about 100 data/sec,is the script run well in
> this condition, and no data lost or error??


The best way to find out is to actually set up a test.

I've seen the following method used in production systems; it avoids
forcing the insert process to wait for an immediate response, and also
allows trying again later in case of problems.

* insert the data into an intermediate table with a column indicating
order of insertion
* separate process, launched on a schedule or by a human operator:
- note the most recent record that exists
- process all rows up to and including that one, either deleting
them or marking them as already processed
- any rows inserted mid-process are left for the next launch
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 07:18 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com