March 18, 2006 at 2:00 pm
hi can it possible ?
to import from text file and put a
cursor to limit the area of the import text!
i explain what i wont.
i have a text file with the word
DN:
it appear evry 12 or 14 rows approximately
how can i thke a area of text
and insert it to one Field in my table
evry time it meet the the word
"DN:"
like put a cursor to this word !!
i need to create a new Record
from the word
"DN:" to the word "DN:"
this is my text file !!!!!!!!!
--------------
in my text file i have a 300000
like this
###########################################
-------------------------------------------------------------------------------
DN: 6361000
TYPE: SINGLE PARTY LINE
SNPA: 304 SIG: DT LNATTIDX: 21
LINE EQUIPMENT NUMBER: AKVA 05 0 22 00
LINE CLASS CODE: 1FR
IBN TYPE: STATION
CUSTGRP: RESGRP SUBGRP: 0 NCOS: 21
LINE TREATMENT GROUP: 21
CARDCODE: 6K18AA GND: N PADGRP: STDLN BNV: NL MNO: N
PM NODE NUMBER : 123
PM TERMINAL NUMBER : 705
OPTIONS: NONE
RES OPTIONS:
MTR DGT PPH RPPO CARR 1 NONE CRA 4
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
DN: 6361002
TYPE: SINGLE PARTY LINE
SNPA: 304 SIG: DT LNATTIDX: 23
LINE EQUIPMENT NUMBER: AKVA 07 0 34 24
LINE CLASS CODE: 1FR
IBN TYPE: STATION
CUSTGRP: RESGRP SUBGRP: 0 NCOS: 23
LINE TREATMENT GROUP: 23
CARDCODE: 6K17BA GND: N PADGRP: STDLN BNV: NL MNO: N
PM NODE NUMBER : 125
PM TERMINAL NUMBER : 1113
CFW INDEX: N/A
OPTIONS: NONE
RES OPTIONS:
CWT CWR CCWB CNDB NOAMA ACB NOAMA AR NOAMA SCWID DGT DDN NOAMA CFDA N NSCR
5 A 24 15046361002 MWT CMWI Y N N N WUCR I VMI N N CARR 1 NONE CRA 1 2 4
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
DN: 6361004
TYPE: SINGLE PARTY LINE
SNPA: 304 SIG: DT LNATTIDX: 20
LINE EQUIPMENT NUMBER: AKVA 04 0 12 24
LINE CLASS CODE: 1FR
IBN TYPE: STATION
CUSTGRP: RESGRP SUBGRP: 0 NCOS: 20
LINE TREATMENT GROUP: 20
CARDCODE: 6K17AC GND: N PADGRP: STDLN BNV: NL MNO: N
PM NODE NUMBER : 122
PM TERMINAL NUMBER : 409
CFW INDEX: N/A
OPTIONS: NONE
RES OPTIONS:
CWT 3WC CWR CCWB CNDB NOAMA ACB NOAMA AR NOAMA DGT DDN NOAMA CFW C NSCR 5 I
$ CFDA N NSCR 5 A 20 15046361004 MWT CMWI Y N N N WUCR I VMI N N CARR 1
NONE
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
-------------------------------------------------------------------------------
thnks
ilan
March 19, 2006 at 2:37 pm
Use ROWTERMINATOR = 'DN:' in BULK INSERT
_____________
Code for TallyGenerator
March 19, 2006 at 3:09 pm
hi
need help
can you show me how to do it
thnks
ilan
March 19, 2006 at 3:55 pm
BOL:
Copies a data file into a database table or view in a user-specified format.
BULK INSERT [ [ 'database_name'.] [ 'owner' ].] { 'table_name' FROM 'data_file' }
[ WITH
(
[ BATCHSIZE [ = batch_size ] ]
[ [ , ] CHECK_CONSTRAINTS ]
[ [ , ] CODEPAGE [ = 'ACP' | 'OEM' | 'RAW' | 'code_page' ] ]
[ [ , ] DATAFILETYPE [ =
{ 'char' | 'native'| 'widechar' | 'widenative' } ] ]
[ [ , ] FIELDTERMINATOR [ = 'field_terminator' ] ]
[ [ , ] FIRSTROW [ = first_row ] ]
[ [ , ] FIRE_TRIGGERS ]
[ [ , ] FORMATFILE = 'format_file_path' ]
[ [ , ] KEEPIDENTITY ]
[ [ , ] KEEPNULLS ]
[ [ , ] KILOBYTES_PER_BATCH [ = kilobytes_per_batch ] ]
[ [ , ] LASTROW [ = last_row ] ]
[ [ , ] MAXERRORS [ = max_errors ] ]
[ [ , ] ORDER ( { column [ ASC | DESC ] } [ ,...n ] ) ]
[ [ , ] ROWS_PER_BATCH [ = rows_per_batch ] ]
[ [ , ] ROWTERMINATOR [ = 'row_terminator' ] ]
[ [ , ] TABLOCK ]
)
]
Example:
BULK INSERT <table Name>
FROM '<OS file Name>'
WITH
(
FIELDTERMINATOR = '\n',
ROWTERMINATOR = 'DN:'
)
_____________
Code for TallyGenerator
March 20, 2006 at 12:10 am
thnks
how to insert each line to each filed in one table ??
like this
-------------------------------------
table1
DN: | TYPE: | SNPA: | LINE EQUIPMENT NUMBER: | LINE CLASS CODE:
6361002 | aaa | bbb |cccc | dddddddd
999999 |ffffff | vvvv | fgfgf | fgfghfhgfh
--------------------------------------------------------
but i have a problem with filed name "RES OPTIONS:"
it appear evry 12 or 14 rows approximately
i thre a solution for it
thnks ilan
March 20, 2006 at 6:55 am
BULK INSERT
_____________
Code for TallyGenerator
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply