I have a table in bigquery that has a column name \"timeStamp\" with data type of STRING. The value in this column looks like this \"20180902\".
This is how I am trying
Below example shows that if value is really "20180902" as you state it should work
#standardSQL
WITH `project.dataset.table` AS (
SELECT '20180902' timeStamp
)
SELECT
`timeStamp`,
PARSE_DATE('%Y%m%d', timeStamp ) AS date
FROM `project.dataset.table`
with result as
Row timeStamp date
1 20180902 2018-09-02
so the issue potentially in some wrong value in some rows - and you need to identify these row(s)
I found the issue. My table had a row at the bottom that had the value "timeStamp" . Deleted that row and everything worked .