DB2 insert content of textfile in long varchar column
I'm not very familiar with db2.. this task would be rather easy in Oracle but I don't know how to do it with db2.
I have the following table:
Data type Column
Column name schema Data type name Length 开发者_JS百科 Scale Nulls
------------------------------- --------- ------------------- ---------- ----- ------
ID TEST CHARACTER 10 0 No
BU TEST CHARACTER 5 0 No
FILETYPE TEST CHARACTER 6 0 No
FILENAME TEST CHARACTER 80 0 No
PATH TEST CHARACTER 254 0 No
TS TEST TIMESTAMP 10 0 Yes
TSYS TEST CHARACTER 50 0 No
STAT TEST CHARACTER 1 0 No
REP TEST LONG VARCHAR 32700 0 Yes
I want to create a new row and the column REP should contain the contents of a textfile. How do I do that?
You can use either the IMPORT or LOAD command:
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/r0008304.htmm
one catch though, I'm not sure that the LOB functionality is going to work with non-LOB columns... although LONG VARCHAR is very similar to CLOB, apart from the max. allowed data size.
精彩评论