Joerg von Frantzius wrote:

> OK, the workaround would be: rename table to a temporary 
> name, create new
> table with the long column, copy temp table over to new table.
> 
> In the end, I want to have an empty string as the value for 
> the LONG column
> in all rows (i.e. not null values).
> 
> The problem is: I created the new table with "not null 
> default ''" for the
> LONG column, so that the empty string will be taken as 
> default value for the
> LONG column. Now when I try to copy the contents into the 
> newly created
> table using "insert into <new_table> (<col>,...) select <col>,... from
> <temp_table>", the whole database crashes completely with 
> error 800, both
> using JDBC and SQL Studio. It has to be restarted manually afterwards.


Oops, this is a bug, will be fixed with the next version.
Thank you for reporting

 
> On the other hand, when I omit the default value on creating 
> the table and
> try "insert into <new_table> (<col>,..,<long_col>) select 
> <col>,..,'' from
> <temp_table>", I get an "SQL statement not allowed for column 
> of data type
> LONG".


Because of historical reasons 
  insert .... select 
is NOT possible, if a LONG-column is selected.
There are plans to overcome this restriction, but this is unfortunately
no change done within some hours. It will last a 'little bit' longer.
No time schedule available by now.

 
> The same happens when I allow null values for the LONG 
> column, copy the rows
> over and then try "update <table> set <long_col>=''".


You can update LONG-columns, but you have to use parameter/hostvariables. 
A long update with literals is not supported by sapdb.

This is a JDBC example from an older mail on this list:
(see http://sapdb.icf.net/cgi/talk-inhalt.html?such=LONG~UPDATE&id=9726)

PreparedStatement UPDATE = conn.prepareStatement ("UPDATE tablename set
LONGcol = ? where keycol = ?");
UPDATE.setAsciiStream (1, someInputStream);
// or insert.setString (1, stringvarWithLONGContent);
UPDATE.setString (2, keyValue);
UPDATE.executeUPDATE ();


Elke
SAP Labs Berlin


> When I did a test with a dummy table containing a LONG 
> column, I wasn't able
> to update the LONG value for a certain row _at_all_. The third of the
> following statements fails with "SQL statement not allowed 
> for column of
> data type LONG":
>       create table test (eins varchar(255), zwei long)
>       insert into test values ('einsvalue', 'zweivalue')
>       update test set zwei='hallozwei' where eins='einsvalue'
> I assume there must be a way of updating a LONG value, so 
> what's my mistake?
> 
> 
> -----Urspr�ngliche Nachricht-----
> Von: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]Im Auftrag von Anhaus,
> Thomas
> Gesendet: Donnerstag, 7. M�rz 2002 10:20
> An: [EMAIL PROTECTED]
> Cc: '[EMAIL PROTECTED]'
> Betreff: RE:Adding a LONG column with ALTER TABLE
> 
> 
> Joerg von Frantzius wrote :
> 
> >Hi all,
> 
> >as it would mean a show-stopper with SAPDB for us, I'd like 
> to ask whether
> >there is any way of adding a column of type LONG to an 
> existing table. When
> >I try to do it with ALTER TABLE, I get an "[-7032] (at 
> 32768) SQL statement
> >not allowed for column of data type LONG:Langtext" error.
> 
> >Is it definitely not possible to add a column of type LONG 
> to an existing
> >table?
> 
> Sorry, at present you have no chance to add a column of 
> dataype LONG to a
> table via
> the <alter table statement>.
> 
> 
> Thomas
> ---
> Thomas Anhaus
> SAPDB, SAP Labs Berlin
> 
> 
> 
> 
> _______________________________________________
> sapdb.general mailing list
> [EMAIL PROTECTED]
> http://listserv.sap.com/mailman/listinfo/sapdb.general
> 
> _______________________________________________
> sapdb.general mailing list
> [EMAIL PROTECTED]
> http://listserv.sap.com/mailman/listinfo/sapdb.general
> 
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to