Catalin Catalin - 4 months ago 5x
SQL Question

Regex put name schema for 'table' in select querry syntax

How can I put with regex, schema name table, for querry select.
Querry don't have fixed size.

example: select * from t1 union select * from t2

result: select * from schema1.t1 union select * from schema1.t2



(1) If you are using it in a code, maybe you can do a search and replace at front end as Luk suggested.

(2) Alternatively, in your current session you can set default schema as schema1 so your query would work without schema name. But it would depend on your database name.

Like in Oracle you can do


Now select * from t1 would effectively mean select * from schema1.t1.

You can search how to set default schema in <your database> in google and you would get syntax for other databases as well.