how to generate a fixed width file from snowflake and unload to internal stage

Viewed 262

I would like to generate a fixed width file from snowflake tables and unload it into internal stage.

Could you please guide me.

Thank you in advance!

1 Answers

One way to do this is to simple concatenate the columns and then add sufficient white space create the width required.

For example if we wanted a column with fixed width of 100, we could do:

USE ROLE SYSADMIN;
USE "SNOWFLAKE_SAMPLE_DATA"."TPCH_SF1";
SELECT RPAD(CONCAT(R_NAME, R_COMMENT), 100) FROM REGION;
Related