I have one PostgreSQL database. I want to export this PostgreSQL database into MS SQL Server database.
For this, first I backup the PostgreSQL database of schema-only
using below command and restore this into SQL Server database. I just replace timestamp without time zone
type to datetime
in SQL Server.
/opt/netiq/idm/apps/postgresql/bin/pg_dump -U admin --schema-only --no-owner --no-privileges testdata > /home/testdata.sql
Then I try to restore PostgreSQL database data inside SQL Server database table. I backup the PostgreSQL database data by using below command
/opt/netiq/idm/apps/postgresql/bin/pg_dump -U admin --data-only --column-inserts testdata > /home/testdata.sql
When I try to restore data from the above dump I am getting the below error
Conversion failed when converting date and/or time from character string
in below query
INSERT INTO databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase) VALUES ('3600', 'IDMRBPM', 'DbRenameTables.xml', '2017-09-06 00:36:31.985959+05:30', 83, 'MARK_RAN', '7:d83f1247d179d535dadf892528470df9', 'renameTable', 'Renaming PORTALREGISTRY to PORTALREGISTRY_ORIG', NULL, '3.1.1');
So please help me to fix this.
I have some below query of PostgreSQL database and I want to know that what is the equivalent query for the below in MS SQL Server.
ALTER TABLE ONLY configuration_item ALTER COLUMN id SET DEFAULT nextval('configuration_item_id_seq'::regclass);
ALTER TABLE ONLY securityaccessrights ADD CONSTRAINT accrts_eliid_uk UNIQUE (fwelementiid, permissionid);
ALTER TABLE ONLY portalportlethandles ADD CONSTRAINT portlethandles_pk PRIMARY KEY (portletiid);
CREATE INDEX afcomment_messageid_idx ON afcomment USING btree (messageid);
ALTER TABLE ONLY afactivity ADD CONSTRAINT fk_activity_proc FOREIGN KEY (requestid) REFERENCES afprocess(requestid) ON DELETE CASCADE;
ALTER TABLE ONLY ui_item ADD CONSTRAINT fk_uiitem_citem FOREIGN KEY (id) REFERENCES configuration_item(id);
I am using MS SQL Server 2014 - 12.0.4100.1 (X64)
and PostgreSQL 9.3.4