We don't have application running on server,
so all the logic need to be done on Bigquery
.
I know Microsoft SQL Server
have check constraint
like:
CREATE TABLE MyCleanJapanClient (
Phone varchar(255) CHECK (Phone LIKE '+81%'),
Email varchar(255) CHECK (Email LIKE '%_@__%.__%')
);
So when I use query like
INSERT INTO `MyCleanJapanClient`
SELECT
Phone AS Phone,
Email AS Email
FROM `YourDirtyJapanClient`;
I got expected error The INSERT statement conflicted with the CHECK constraint
But with Bigquery,
how can I validate data like using check constraint?
As mentioned by @Kolban, there is no equivalent to the T-SQL dialect "CHECK" capability in BigQuery.
You can use the Data Quality capabilities and periodically validate/detect whether or not your table rows meet quality considerations.
For more information you can refer to the following link.