pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedMSSQL to PostgreSQL Migration
12+ messages / 10 participants
[nested] [flat]
* MSSQL to PostgreSQL Migration
@ 2023-01-01 18:11 Datta D <dattadeshpande.it@gmail.com>
2023-01-01 18:28 ` Re: MSSQL to PostgreSQL Migration Alan Piszcz <ap@solarrain.com>
2023-01-02 08:11 ` RE: MSSQL to PostgreSQL Migration Pascal CROZET <pascal.crozet@metanext.com>
2023-01-09 22:59 ` Re: MSSQL to PostgreSQL Migration Samed YILDIRIM <samed@reddoc.net>
0 siblings, 3 replies; 12+ messages in thread
From: Datta D @ 2023-01-01 18:11 UTC (permalink / raw)
To: pgsql-admin
Dear Admins
I am looking for a reliable open-source tool for migrating MSSQL server to
Postgresql on prem cloud.
Can you please suggest a related open-source tool for migrating all
objects and data?
Thanks
Datta
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: MSSQL to PostgreSQL Migration
2023-01-01 18:11 MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
@ 2023-01-01 18:28 ` Alan Piszcz <ap@solarrain.com>
2 siblings, 0 replies; 12+ messages in thread
From: Alan Piszcz @ 2023-01-01 18:28 UTC (permalink / raw)
To: Datta D <dattadeshpande.it@gmail.com>; pgsql-admin
One is pgloader, syntax is different.
Pgloader vs. DBConvert - Migrate from MySQL to PostgreSQL – DBConvert<https://support.dbconvert.com/hc/en-us/articles/360017715399-Pgloader-vs-DBConvert-Migrate-from-MySQ...;
[https://theme.zdassets.com/theme_assets/574048/d715c78beedba99e2b63d2a340f555ab8c5146f4.png]<https://support.dbconvert.com/hc/en-us/articles/360017715399-Pgloader-vs-DBConvert-Migrate-from-MySQ...;
Pgloader vs. DBConvert - Migrate from MySQL to PostgreSQL – DBConvert - Medium<https://support.dbconvert.com/hc/en-us/articles/360017715399-Pgloader-vs-DBConvert-Migrate-from-MySQ...;
DBConvert database migration software. DBConvert & DBSync for MySQL and PostgreSQL are popular software tools that minimize the challenges of migrating and syncing data between MySQL and PostgreSQL databases.. DBConvert/ DBSync for MySQL and PostgreSQL Pros.: In any combination, using our MySQL to PostgreSQL converter, data migrations between the following databases are possible:
support.dbconvert.com
________________________________
From: Datta D <dattadeshpande.it@gmail.com>
Sent: Sunday, January 1, 2023 1:11 PM
To: pgsql-admin@postgresql.org <pgsql-admin@postgresql.org>
Subject: MSSQL to PostgreSQL Migration
Dear Admins
I am looking for a reliable open-source tool for migrating MSSQL server to Postgresql on prem cloud.
Can you please suggest a related open-source tool for migrating all objects and data?
Thanks
Datta
^ permalink raw reply [nested|flat] 12+ messages in thread
* RE: MSSQL to PostgreSQL Migration
2023-01-01 18:11 MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
@ 2023-01-02 08:11 ` Pascal CROZET <pascal.crozet@metanext.com>
2023-01-02 08:22 ` RE: MSSQL to PostgreSQL Migration Pascal CROZET <pascal.crozet@metanext.com>
2 siblings, 1 reply; 12+ messages in thread
From: Pascal CROZET @ 2023-01-02 08:11 UTC (permalink / raw)
To: Datta D <dattadeshpande.it@gmail.com>; pgsql-admin
Hi Datta D
You can use ora2pg<https://ora2pg.darold.net/; that can help you to migrate also from MySql.
Moves Oracle and MySQL database to PostgreSQL
I’ve use it to migrate in cloud IaaS from Oracle to PG 14
From: Datta D <dattadeshpande.it@gmail.com>
Sent: Sunday, January 1, 2023 7:12 PM
To: pgsql-admin@postgresql.org
Subject: MSSQL to PostgreSQL Migration
Dear Admins
I am looking for a reliable open-source tool for migrating MSSQL server to Postgresql on prem cloud.
Can you please suggest a related open-source tool for migrating all objects and data?
Thanks
Datta
^ permalink raw reply [nested|flat] 12+ messages in thread
* RE: MSSQL to PostgreSQL Migration
2023-01-01 18:11 MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2023-01-02 08:11 ` RE: MSSQL to PostgreSQL Migration Pascal CROZET <pascal.crozet@metanext.com>
@ 2023-01-02 08:22 ` Pascal CROZET <pascal.crozet@metanext.com>
2023-01-03 22:07 ` Re: MSSQL to PostgreSQL Migration Dan Smith <j.daniel.smith1@gmail.com>
2023-01-05 10:13 ` Re: MSSQL to PostgreSQL Migration Gilles Darold <gilles@darold.net>
0 siblings, 2 replies; 12+ messages in thread
From: Pascal CROZET @ 2023-01-02 08:22 UTC (permalink / raw)
To: Datta D <dattadeshpande.it@gmail.com>; pgsql-admin
Datta D.
I’ve read MySql instead of MsSql :/ Sorry. I prefer to name it as SqlServer, to avoid this issue.
In this page<https://dbconvert.com/blog/migrate-data-from-sql-server-to-postgresql/;, you can found pgloader or Sqlserver2pgsql as open source tools
From: Pascal CROZET
Sent: Monday, January 2, 2023 9:12 AM
To: Datta D <dattadeshpande.it@gmail.com>; pgsql-admin@postgresql.org
Subject: RE: MSSQL to PostgreSQL Migration
Hi Datta D
You can use ora2pg<https://ora2pg.darold.net/; that can help you to migrate also from MySql.
Moves Oracle and MySQL database to PostgreSQL
I’ve use it to migrate in cloud IaaS from Oracle to PG 14
From: Datta D <dattadeshpande.it@gmail.com<mailto:dattadeshpande.it@gmail.com>>
Sent: Sunday, January 1, 2023 7:12 PM
To: pgsql-admin@postgresql.org<mailto:pgsql-admin@postgresql.org>
Subject: MSSQL to PostgreSQL Migration
Dear Admins
I am looking for a reliable open-source tool for migrating MSSQL server to Postgresql on prem cloud.
Can you please suggest a related open-source tool for migrating all objects and data?
Thanks
Datta
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: MSSQL to PostgreSQL Migration
2023-01-01 18:11 MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2023-01-02 08:11 ` RE: MSSQL to PostgreSQL Migration Pascal CROZET <pascal.crozet@metanext.com>
2023-01-02 08:22 ` RE: MSSQL to PostgreSQL Migration Pascal CROZET <pascal.crozet@metanext.com>
@ 2023-01-03 22:07 ` Dan Smith <j.daniel.smith1@gmail.com>
1 sibling, 0 replies; 12+ messages in thread
From: Dan Smith @ 2023-01-03 22:07 UTC (permalink / raw)
To: pgsql-admin
The AWS schema Conversion Tool might be helpful for MS SQL Server
migrations to Postgres (
https://docs.aws.amazon.com/SchemaConversionTool/latest/userguide/CHAP_Welcome.html).
It will at least help you determine level of effort and which objects might
need refactoring.
Best regards,
Dan Smith
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: MSSQL to PostgreSQL Migration
2023-01-01 18:11 MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2023-01-02 08:11 ` RE: MSSQL to PostgreSQL Migration Pascal CROZET <pascal.crozet@metanext.com>
2023-01-02 08:22 ` RE: MSSQL to PostgreSQL Migration Pascal CROZET <pascal.crozet@metanext.com>
@ 2023-01-05 10:13 ` Gilles Darold <gilles@darold.net>
1 sibling, 0 replies; 12+ messages in thread
From: Gilles Darold @ 2023-01-05 10:13 UTC (permalink / raw)
To: Pascal CROZET <pascal.crozet@metanext.com>; Datta D <dattadeshpande.it@gmail.com>; pgsql-admin
Le 02/01/2023 à 09:22, Pascal CROZET a écrit :
>
> Datta D.
>
> I’ve read MySql instead of MsSql :/ Sorry. I prefer to name it as
> SqlServer, to avoid this issue.
>
> In this page
> <https://dbconvert.com/blog/migrate-data-from-sql-server-to-postgresql/;,
> you can found /pgloader or Sqlserver2pgsql/as open source tools
>
Actually, I need it for a customer migration at MigOps, so it does since
few days:
commit 7d9796b2949982867925eaebaa112bf5520403d5
Merge: 4220916 c911903
Author: Gilles Darold <gilles@darold.net>
Date: Tue Nov 29 21:11:58 2022 +0100
Add SQL Server migration to Ora2Pg. Most of the SQL Server objects are
supported as well as data export. Translation of the TSQL stored
procedures to plpgsql is complicated because of the lack of statement
separator in TSQL but as usual Ora2Pg is doing is best to do as much
work as possible. Migration assessment is also possible with SQL Server
database. There is some dedicated configuration directives added to
ora2Pg.conf.
I have planned to publish a new release and an announcement this month.
Note that it is a new feature that needs to be polished, your feed back
will be welcome.
If you can't wait the new release you can download the development code
using git or as an archive from
https://github.com/darold/ora2pg/archive/refs/heads/master.zip
It just works like an Oracle migration, the most complicated thing is to
connect Ora2Pg to the remote SQL Server database :-)
There is only 2 new configuration directive related to this RDBMS:
Control SQL Server export behavior
DROP_ROWVERSION
PostgreSQL has no equivalent to rowversion datatype and feature, if
you want to remove these useless columns, enable this directive.
Columns of datatype 'rowversion' or 'timestamp' will not be
exported.
CASE_INSENSITIVE_SEARCH
Emulate the same behavior of MSSQL with case insensitive search. If
the value is citext it will use the citext data type instead of
char/varchar/text in tables DDL (Ora2Pg will add a CHECK constraint
for columns with a precision). Instead of citext you can also set a
collation name that will be used in the columns definitions. To
disable case insensitive search set it to: none.
Look at documentation (README) on how to migrate a SQL Server database
with Ora2Pg.
Best regards,
--
Gilles Darold
MigOps Inc
http://www.migops.com/
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: MSSQL to PostgreSQL Migration
2023-01-01 18:11 MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
@ 2023-01-09 22:59 ` Samed YILDIRIM <samed@reddoc.net>
2023-01-12 03:14 ` Re: MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2 siblings, 1 reply; 12+ messages in thread
From: Samed YILDIRIM @ 2023-01-09 22:59 UTC (permalink / raw)
To: Datta D <dattadeshpande.it@gmail.com>; +Cc: pgsql-admin
Hi Datta,
What objects do you exactly need to migrate? Tables, views, functions,
indexes, procedures etc. Depending on object types, I can recommend
multiple options. Unfortunately, I don't know any good solution that can
convert all T-SQL code to pl/pgsql.
Best regards.
Samed YILDIRIM
On Sun, 1 Jan 2023 at 20:12, Datta D <dattadeshpande.it@gmail.com> wrote:
> Dear Admins
> I am looking for a reliable open-source tool for migrating MSSQL server
> to Postgresql on prem cloud.
> Can you please suggest a related open-source tool for migrating all
> objects and data?
>
> Thanks
> Datta
>
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: MSSQL to PostgreSQL Migration
2023-01-01 18:11 MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2023-01-09 22:59 ` Re: MSSQL to PostgreSQL Migration Samed YILDIRIM <samed@reddoc.net>
@ 2023-01-12 03:14 ` Datta D <dattadeshpande.it@gmail.com>
2023-01-12 03:21 ` Re: MSSQL to PostgreSQL Migration Gurudutt Dhareshwar <gurudutt.dhareshwar@gmail.com>
0 siblings, 1 reply; 12+ messages in thread
From: Datta D @ 2023-01-12 03:14 UTC (permalink / raw)
To: Samed YILDIRIM <samed@reddoc.net>; +Cc: pgsql-admin
Hi Samed
I have all type of objects tables,views, functions, procs etc with Data in
table SqlServer database, which I am looking for migrating it to Postgresql
with OpenSource tools.
Thanks
Datta
On Mon, Jan 9, 2023 at 5:59 PM Samed YILDIRIM <samed@reddoc.net> wrote:
> Hi Datta,
>
> What objects do you exactly need to migrate? Tables, views, functions,
> indexes, procedures etc. Depending on object types, I can recommend
> multiple options. Unfortunately, I don't know any good solution that can
> convert all T-SQL code to pl/pgsql.
>
> Best regards.
> Samed YILDIRIM
>
>
> On Sun, 1 Jan 2023 at 20:12, Datta D <dattadeshpande.it@gmail.com> wrote:
>
>> Dear Admins
>> I am looking for a reliable open-source tool for migrating MSSQL server
>> to Postgresql on prem cloud.
>> Can you please suggest a related open-source tool for migrating all
>> objects and data?
>>
>> Thanks
>> Datta
>>
>
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: MSSQL to PostgreSQL Migration
2023-01-01 18:11 MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2023-01-09 22:59 ` Re: MSSQL to PostgreSQL Migration Samed YILDIRIM <samed@reddoc.net>
2023-01-12 03:14 ` Re: MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
@ 2023-01-12 03:21 ` Gurudutt Dhareshwar <gurudutt.dhareshwar@gmail.com>
2023-01-12 15:08 ` Re: MSSQL to PostgreSQL Migration Alex Aquino <alex@efficiencygeek.com>
2023-01-12 17:37 ` Re: MSSQL to PostgreSQL Migration Holger Jakobs <holger@jakobs.com>
0 siblings, 2 replies; 12+ messages in thread
From: Gurudutt Dhareshwar @ 2023-01-12 03:21 UTC (permalink / raw)
To: Datta D <dattadeshpande.it@gmail.com>; +Cc: Samed YILDIRIM <samed@reddoc.net>; pgsql-admin
Hi Datta ,
You can extract the data using the SSM Tool right click on the DB and use
the extract wizard once done you can use a open source tool like SQLline to
change the code. and then create them in Postgres .
For data you can move it using the SQL tool itself or take a BCP Out and
then insert using the psql -d option .
On Wed, Jan 11, 2023 at 7:14 PM Datta D <dattadeshpande.it@gmail.com> wrote:
> Hi Samed
> I have all type of objects tables,views, functions, procs etc with Data
> in table SqlServer database, which I am looking for migrating it to
> Postgresql with OpenSource tools.
>
> Thanks
> Datta
>
> On Mon, Jan 9, 2023 at 5:59 PM Samed YILDIRIM <samed@reddoc.net> wrote:
>
>> Hi Datta,
>>
>> What objects do you exactly need to migrate? Tables, views, functions,
>> indexes, procedures etc. Depending on object types, I can recommend
>> multiple options. Unfortunately, I don't know any good solution that can
>> convert all T-SQL code to pl/pgsql.
>>
>> Best regards.
>> Samed YILDIRIM
>>
>>
>> On Sun, 1 Jan 2023 at 20:12, Datta D <dattadeshpande.it@gmail.com> wrote:
>>
>>> Dear Admins
>>> I am looking for a reliable open-source tool for migrating MSSQL server
>>> to Postgresql on prem cloud.
>>> Can you please suggest a related open-source tool for migrating all
>>> objects and data?
>>>
>>> Thanks
>>> Datta
>>>
>>
--
Regards,
Gurudutt Dhareshwar
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: MSSQL to PostgreSQL Migration
2023-01-01 18:11 MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2023-01-09 22:59 ` Re: MSSQL to PostgreSQL Migration Samed YILDIRIM <samed@reddoc.net>
2023-01-12 03:14 ` Re: MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2023-01-12 03:21 ` Re: MSSQL to PostgreSQL Migration Gurudutt Dhareshwar <gurudutt.dhareshwar@gmail.com>
@ 2023-01-12 15:08 ` Alex Aquino <alex@efficiencygeek.com>
1 sibling, 0 replies; 12+ messages in thread
From: Alex Aquino @ 2023-01-12 15:08 UTC (permalink / raw)
To: Gurudutt Dhareshwar <gurudutt.dhareshwar@gmail.com>; +Cc: Datta D <dattadeshpande.it@gmail.com>; Samed YILDIRIM <samed@reddoc.net>; pgsql-admin
I'd suggest looking into https://babelfishpg.org/.
'Babelfish understands the SQL Server wire-protocol and T-SQL, the
Microsoft SQL Server query language, so you don’t have to switch database
drivers or re-write all of your application queries.'
This was formerly an AWS project that they fully opensourced (
https://aws.amazon.com/rds/aurora/babelfish/).
Dependening on the specifics of your usecase, it might help in your overall
solution.
Regards,
Alex
On Wed, Jan 11, 2023 at 9:21 PM Gurudutt Dhareshwar <
gurudutt.dhareshwar@gmail.com> wrote:
> Hi Datta ,
>
> You can extract the data using the SSM Tool right click on the DB and use
> the extract wizard once done you can use a open source tool like SQLline to
> change the code. and then create them in Postgres .
>
> For data you can move it using the SQL tool itself or take a BCP Out and
> then insert using the psql -d option .
>
> On Wed, Jan 11, 2023 at 7:14 PM Datta D <dattadeshpande.it@gmail.com>
> wrote:
>
>> Hi Samed
>> I have all type of objects tables,views, functions, procs etc with Data
>> in table SqlServer database, which I am looking for migrating it to
>> Postgresql with OpenSource tools.
>>
>> Thanks
>> Datta
>>
>> On Mon, Jan 9, 2023 at 5:59 PM Samed YILDIRIM <samed@reddoc.net> wrote:
>>
>>> Hi Datta,
>>>
>>> What objects do you exactly need to migrate? Tables, views, functions,
>>> indexes, procedures etc. Depending on object types, I can recommend
>>> multiple options. Unfortunately, I don't know any good solution that can
>>> convert all T-SQL code to pl/pgsql.
>>>
>>> Best regards.
>>> Samed YILDIRIM
>>>
>>>
>>> On Sun, 1 Jan 2023 at 20:12, Datta D <dattadeshpande.it@gmail.com>
>>> wrote:
>>>
>>>> Dear Admins
>>>> I am looking for a reliable open-source tool for migrating MSSQL
>>>> server to Postgresql on prem cloud.
>>>> Can you please suggest a related open-source tool for migrating all
>>>> objects and data?
>>>>
>>>> Thanks
>>>> Datta
>>>>
>>>
>
> --
> Regards,
>
> Gurudutt Dhareshwar
>
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: MSSQL to PostgreSQL Migration
2023-01-01 18:11 MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2023-01-09 22:59 ` Re: MSSQL to PostgreSQL Migration Samed YILDIRIM <samed@reddoc.net>
2023-01-12 03:14 ` Re: MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2023-01-12 03:21 ` Re: MSSQL to PostgreSQL Migration Gurudutt Dhareshwar <gurudutt.dhareshwar@gmail.com>
@ 2023-01-12 17:37 ` Holger Jakobs <holger@jakobs.com>
2023-01-12 18:09 ` Re: MSSQL to PostgreSQL Migration JP Pozzi <jpp@jppozzi.dyndns.org>
1 sibling, 1 reply; 12+ messages in thread
From: Holger Jakobs @ 2023-01-12 17:37 UTC (permalink / raw)
To: pgsql-admin@lists.postgresql.org
Am 12.01.23 um 04:21 schrieb Gurudutt Dhareshwar:
> For data you can move it using the SQL tool itself or take a BCP Out
> and then insert using the psql -d option .
Actually, bcp.exe does not do a very good job. It cannot make a
difference between an empty string and a NULL value, for instance.
If you try to export in tab-separated format
(https://www.iana.org/assignments/media-types/text/tab-separated-values),
carriage returns, newlines, tab character will all mess up the output.
And contained backslashes are not doubled as necessary for PG's copy
statement.
In case your tables aren't too large, you can export via PowerShell
keeping the differences between NULL and empty string. The way via JSON
may be a bit slow and heavy on memory, though.
### Code for Powershell
install-module sqlserver
$SqlParams = @{
ServerInstance = 'server_name'
UserName = 'user_name'
Password = 'very_secret'
Database = 'db_name'
}
$tableName = 'whatever_tablename'
(invoke-sqlcmd @SqlParams -query "Select * from $tableName" |
select-object * -excludeproperty
itemarray,table,rowerror,rowstate,haserrors |
convertto-json).replace('null', '"§n§"') | convertfrom-json | export-csv
-path "$($tableName).csv" -usequotes asneeded
### import using psql
\copy whatever_tablename from whatever_tablename.csv (format csv, header
on);
Kind Regards,
Holger
--
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
Attachments:
[application/pgp-signature] OpenPGP_signature (202B, ../../bb68633a-28d7-2a46-f815-c64dbb2660d2@jakobs.com/2-OpenPGP_signature)
download
^ permalink raw reply [nested|flat] 12+ messages in thread
* Re: MSSQL to PostgreSQL Migration
2023-01-01 18:11 MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2023-01-09 22:59 ` Re: MSSQL to PostgreSQL Migration Samed YILDIRIM <samed@reddoc.net>
2023-01-12 03:14 ` Re: MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2023-01-12 03:21 ` Re: MSSQL to PostgreSQL Migration Gurudutt Dhareshwar <gurudutt.dhareshwar@gmail.com>
2023-01-12 17:37 ` Re: MSSQL to PostgreSQL Migration Holger Jakobs <holger@jakobs.com>
@ 2023-01-12 18:09 ` JP Pozzi <jpp@jppozzi.dyndns.org>
0 siblings, 0 replies; 12+ messages in thread
From: JP Pozzi @ 2023-01-12 18:09 UTC (permalink / raw)
To: Holger Jakobs <holger@jakobs.com>; +Cc: pgsql-admin@lists.postgresql.org
Hello,
You can also look at Postgresql Foreign Data Wrapper (FDW) which can give access to
"foreign" tables even for MSSQL.
The transfer will be immediate as :
insert into postgres_table select * from mssql_table;
Regards
JP P
----- Mail original -----
De: "Holger Jakobs" <holger@jakobs.com>
À: pgsql-admin@lists.postgresql.org
Envoyé: Jeudi 12 Janvier 2023 18:37:08
Objet: Re: MSSQL to PostgreSQL Migration
Am 12.01.23 um 04:21 schrieb Gurudutt Dhareshwar:
> For data you can move it using the SQL tool itself or take a BCP Out
> and then insert using the psql -d option .
Actually, bcp.exe does not do a very good job. It cannot make a
difference between an empty string and a NULL value, for instance.
If you try to export in tab-separated format
(https://www.iana.org/assignments/media-types/text/tab-separated-values),
carriage returns, newlines, tab character will all mess up the output.
And contained backslashes are not doubled as necessary for PG's copy
statement.
In case your tables aren't too large, you can export via PowerShell
keeping the differences between NULL and empty string. The way via JSON
may be a bit slow and heavy on memory, though.
### Code for Powershell
install-module sqlserver
$SqlParams = @{
ServerInstance = 'server_name'
UserName = 'user_name'
Password = 'very_secret'
Database = 'db_name'
}
$tableName = 'whatever_tablename'
(invoke-sqlcmd @SqlParams -query "Select * from $tableName" |
select-object * -excludeproperty
itemarray,table,rowerror,rowstate,haserrors |
convertto-json).replace('null', '"§n§"') | convertfrom-json | export-csv
-path "$($tableName).csv" -usequotes asneeded
### import using psql
\copy whatever_tablename from whatever_tablename.csv (format csv, header
on);
Kind Regards,
Holger
--
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
^ permalink raw reply [nested|flat] 12+ messages in thread
end of thread, other threads:[~2023-01-12 18:09 UTC | newest]
Thread overview: 12+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-01-01 18:11 MSSQL to PostgreSQL Migration Datta D <dattadeshpande.it@gmail.com>
2023-01-01 18:28 ` Alan Piszcz <ap@solarrain.com>
2023-01-02 08:11 ` Pascal CROZET <pascal.crozet@metanext.com>
2023-01-02 08:22 ` Pascal CROZET <pascal.crozet@metanext.com>
2023-01-03 22:07 ` Dan Smith <j.daniel.smith1@gmail.com>
2023-01-05 10:13 ` Gilles Darold <gilles@darold.net>
2023-01-09 22:59 ` Samed YILDIRIM <samed@reddoc.net>
2023-01-12 03:14 ` Datta D <dattadeshpande.it@gmail.com>
2023-01-12 03:21 ` Gurudutt Dhareshwar <gurudutt.dhareshwar@gmail.com>
2023-01-12 15:08 ` Alex Aquino <alex@efficiencygeek.com>
2023-01-12 17:37 ` Holger Jakobs <holger@jakobs.com>
2023-01-12 18:09 ` JP Pozzi <jpp@jppozzi.dyndns.org>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox