PostgreSQL Link from another database
Activate function DBlink :
CREATE EXTENSION dblink;
Result :
OK
Select from another database Query :
SELECT *
FROM dblink('host=servername user=username password=password dbname=databasename', 'select column1, column2 from TableProductMaster ')
AS t1(Column1 text, Column2 text) -- as field and field type
WHERE column1 LIKE '%556%' -- as Condition
Order by Column1 Asc;
Result :
Column 1 | Column2
A|1
B|2
C|3
Thank You
Activate function DBlink :
CREATE EXTENSION dblink;
Connection Link Query :
select dblink_connect('host=servername user=username password=password dbname=databasename') ;Result :
OK
Select from another database Query :
SELECT *
FROM dblink('host=servername user=username password=password dbname=databasename', 'select column1, column2 from TableProductMaster ')
AS t1(Column1 text, Column2 text) -- as field and field type
WHERE column1 LIKE '%556%' -- as Condition
Order by Column1 Asc;
Result :
Column 1 | Column2
A|1
B|2
C|3
Thank You
1 comment:
Iam facing with an error when executing connection link query. ERROR: could not establish connection
Post a Comment