snowflake 中的 varchar(n) 是什么意思?

What does varchar(n) in snowflake mean?

我在 snowflake 中有一个包含大 URL 的列,我给了它 varchar(50),varchar(50) 是否意味着它只能存储 50 个字符?

谢谢, 习

Does varchar(50) mean it can only store 50 characters?

是的。

CREATE OR REPLACE TABLE t(col VARCHAR(50));

INSERT INTO t(col) SELECT REPEAT('a', 51);
-- String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
-- and would be truncated


SELECT CAST(REPEAT('a', 51) AS VARCHAR(50));
-- String 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' is too long
-- and would be truncated