So I'm SLOWLY rewriting a text file and I'm wondering if there's someone who can tell me of a utility to do it.
 
I have a MS SQL 7 server, I've created a "SQL Script" which would create ~120 new tables, and objects if I ran it on another MS SQL server.
 
The SQL is the usual MS stuff...
 
I'm trying to create the database in Postgres, and here's where I'm at.
 
I have the tables and the data migrated.  No problem.  But I need the defaults.
 
So I need to turn
 
ALTER TABLE [DBO].[ACCRUAL_DETAIL] WITH NOCHECK ADD
    CONSTRAINT [DF_ACCRUAL_DETAIL_INVOICE_LOCATION] DEFAULT ('A') FOR [INVOICE_LOCATION],
    CONSTRAINT [DF_ACCRUAL_DETAIL_LINE_INVOICE] DEFAULT (0) FOR [LINE_SEQUENCE],
etc, etc, etc.
 
into
 
ALTER TABLE "ACCRUAL_DETAIL" ALTER COLUMN "INVOICE_LOCATION" SET DEFAULT ('A');
ALTER TABLE "ACCRUAL_DETAIL" ALTER COLUMN "LINE_INVOICE" SET DEFAULT (0);
etc, etc, etc.
 
There are literally thousands of similar lines, and I'd LOVE it if someone could recommend a script that would re-write this for me.
 
Is there one?  Or am I writing my own spaghetti code for it?
 
Thanks in advance.
Kev.
 

Reply via email to