Convert all row table to column in Hana

You can convert all row table to column table with below procedure:

create procedure convert_column() LANGUAGE SQLSCRIPT AS
CURSOR C_TABLE
FOR SELECT 'ALTER TABLE "' || TABLE_NAME || '" COLUMN;' AS SQLTEXT
FROM SYS.TABLES
WHERE SCHEMA_NAME = 'SAPABAP1' AND TABLE_TYPE = 'ROW' and temporary_table_type = 'NONE';
BEGIN
  OPEN C_TABLE;
  FOR cur_row AS C_TABLE DO
    EXEC cur_row.SQLTEXT;
  END FOR;
END;

You can execute below procedure like this:

CALL convert_column;

Bir Cevap Bırakın

XHTML: Şu etiketleri kullanabilirsiniz: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>