简体   繁体   中英

Check if the column is Valid in Bigquery Table

I have a bigquery table with a column as time_created. The data type of this column is TIMESTAMP. Now I want to know if the column containss invalid values like ""," ", "some_string","++--". How can I check that?

As mentioned in the comment, if your data is of type TIMESTAMP , it shall not contain any string or unsupported characters.

However, if you want you can try converting timestamp to string and then check for unwanted characters.

select * from table
    where cast(time_field as string) like "%--++%"

Just like @Shadow mentioned, the timestamp field type does not allow to store random strings.

Anyway, if you want to perform those checks on any field, the best way to do it is by using the LIKE operator.

SELECT COUNT(*)
FROM myTable
WHERE field LIKE "%++--%"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM