how will you write the follow from SQL server in starburst
left(I.UserText13,100)
how will you write the follow from SQL server in starburst
left(I.UserText13,100)
To start from the left of a string and then only grab N number of characters, you can use substr
as doc’d in String functions and operators — Trino 475 Documentation.
So…
substr(l.UserText13, 1, 100)
Here are a couple of examples of pulling from the left AND from the right (which looks a bit more weird)…
SELECT name FROM tpch.tiny.customer where custkey = 1;
-- returns: Customer#000000001
-- get first 4 values
SELECT substr(name, 1, 4) FROM tpch.tiny.customer where custkey = 1;
-- returns: Cust
-- get LAST 4 values is a BIT WEIRDER!
SELECT substr(name, length(name) -4 + 1) FROM tpch.tiny.customer where custkey = 1;
-- returns: 0001