0

I need to get the column number of a staged file on Snowflake.

The main idea behind it, is that I need to automate getting this field in other queries rather than using t.$3 whereas 3 is the position of the field, that might be changed because we are having an expandable surveys (more or less questions depending on the situation).

So what I need is something like that:

SELECT COL_NUMBER FROM @my_stage/myfile.csv  WHERE value = 'my_column_name` 
-- Without any file format to read the header

And then this COL_NUMBER could be user as t.$"+COL_NUMBER+" inside merge queries.

Shadow
  • 33,525
  • 10
  • 51
  • 64
alim1990
  • 4,656
  • 12
  • 67
  • 130

0 Answers0