I'm trying to convert a sample database file from MS SQL Server to PostgreSQL - there's a sample table at the bottom of this question.
So, I'm having two small niggles that I can't resolve. This is a sample line from the database file (see the fiddle here - you can alternatve between SQL Server and PostgreSQL):
===============p.s. thought this would be trivial.
Sample table - please see the fiddle here - you can alternate between SQL Server (input) and PostgreSQL (output)Have data like this:
[pol@fedora data]$ more tab.sql 
CREATE TABLE employee
(
  empid           INT          NOT NULL IDENTITY,
  lastname        NVARCHAR(20) NOT NULL,
  firstname       NVARCHAR(10) NOT NULL,
  title           NVARCHAR(30) NULL,
  titleofcourtesy NVARCHAR(25) NULL,
  birthdate       DATE         NOT NULL,
  hiredate        DATE         NOT NULL,
  address         NVARCHAR(60) NOT NULL,
  city            NVARCHAR(15) NOT NULL,
  region         N'Strada NVARCHAR(15)Provinciale NULL1234',
  postalcode      NVARCHAR(10)N'Reggio NULLEmilia',
  country         NVARCHAR(15) NOT NULL,
  phone           NVARCHAR(24) NOT NULLN'10289',
  mgrid           INT          NULL
N'Italy');
 Desired outputI want to change the N' into just plain apostrophe ' (the N' is a SQL Server thing) but I don't want to change the NULL into the empty string, or worse ULL - so I tried:
CREATE TABLE employee
(
  empid           INT           GENERATED BY DEFAULT AS IDENTITY,
  lastname        TEXT NOT NULL CHECK (LENGTH(lastname) <= 20),
  firstname       TEXT NOT NULL CHECK (LENGTH(firstname) <=  10),
  title           TEXT     NULL,           --[pol@fedora paydata]$ attentionsed to's/N\'\'/g theseTSQLV5.sql two!
  titleofcourtesy TEXT     NULL,          but get
sed: --          "
  birthdate       DATE NOT NULL,
  hiredate        DATE NOT NULL,
  
  address         TEXT NOT NULL CHECK (LENGTH(address) <= 60),
  city            TEXT NOT NULL CHECK (LENGTH(city) <= 15),
  region          TEXT     NULL CHECK (LENGTH(region) <= 15),
  postalcode      TEXT     NULL CHECK (LENGTH(postalcode) <= 10),
  country         TEXT NOT NULL CHECK (LENGTH(country) <=  15),
  
  phone           TEXT NOT NULL CHECK (LENGTH(phone) <= 24),
  mgrid           INT    e expression NULL#1,
  test_field      TEXT     NULL CHECK (LENGTH(test_field) <= 25)char 7: 
 unterminated `s' 
);command
 I know that I've used sed a lot, but would be open to any awk commands that could perform the tasks required.
 
                 
                 
                