MS SQL to PostgreSQL migration strategies

Nowadays many companies migrate their databases to free open-source DBMS in order to reduce total cost of ownership. PostgreSQL looks really good option among all free systems because it is 100% compliant with SQL standard, supports point-in-time recovery and sophisticated locking mechanisms, provides advanced data types such as multi-dimensional arrays and spatial.

The most straight forward way to migrate from MS SQL to PostgreSQL is based on popular extract-transfer-load (ETL) model:

  • All table definitions, indexes and constraints are extracted from SQL Server database in form of CREATE-statements
  • Those statements are converted according to PostgreSQL specification of CREATE-queries (with respect to types mapping and naming rules) and loaded to the target database
  • Next step is to export SQL Server data into CSV files as external intermediate storage
  • The CSV files must be transformed to comply with PostgreSQL format when it is necessary
  • Finally, the transformed data must be loaded to the target database

This is how to extract definitions of MS SQL tables in required format:

  • In MS SQL 2008 and earlier versions open Management Studio, right-click on the database name, then click on ‘Tasks > Generate Scripts’ menu item. Make sure that “data” checkbox is off.
  • In MS SQL 2012 and later versions open Management Studio, right-click on the database name, then click on ‘Tasks > Generate Scripts’ menu item. In appeared window go to “Set scripting options” tab, click on Advanced link and select “data and schema” in the ‘General’ section.

Don’t forget to transform the resulting script according to PostgreSQL format before moving to the next step:

  • remove square brackets around types
  • change square brackets around database object names by double quotes
  • replace all occurrences of schema “dbo” by “public”
  • remove all optional MS SQL keywords that are not supported by PostgreSQL (i.e. “WITH NOCHECK”, “CLUSTERED”)
  • remove any specifications of filegroup, for example “ON PRIMARY”
  • change MS SQL auto-number types “INT IDENTITY(…)” by “SERIAL”
  • convert types that are not supported by PostgreSQL into equivalents (i.e. “DATETIME” becomes “TIMESTAMP”, “MONEY” becomes NUMERIC(19,4))
  • replace SQL Server query terminator “GO” by the PostgreSQL one “;”

The next move is to process the data, which can be accomplished with the use of the MS SQL Management Studio.

  • Right-click on database, then click Tasks, Export Data
  • Go through the wizard and select “Microsoft OLE DB Provider for SQL Server” as data source, and “Flat File Destination” as destination.

As soon as the export is finalized, the exported data will exists in the destination file in the comma-separated values (CSV) format.

Now it is time to load data from CSV files to PostgreSQL tables. For this purpose, use the “COPY” statement as follows:

COPY <table name> FROM <path to csv file> DELIMITER ‘,’ CSV;

If you receive a “Permission denied” error, try the “\COPY” command instead.

The steps above illustrate that manual conversion is a time-consuming procedure with high risk of data loss or corruption. Fortunately, there are some special tools which can migrate database from MS SQL to PostgreSQL within just a couple of clicks. One of such solutions is MS SQL to PostgreSQL converter, a program having all necessary features to handle migration of large and complicated databases between the two DBMS. It is developed by Intelligent Converters, software company focusing on database conversion and synchronization techniques since 2001.


Posted in Technology and tagged .


  1. trouble ejaculating when using viagra
    viagra buy best online pharmacy for viagra
    over the counter viagra substitute cvs

  2. Hey there would you mind stating which blog platform you’re working with? I’m planning to start my own blog in the near future but I’m having a hard time making a decision between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I’m looking for something completely unique. P.S Sorry for being off-topic but I had to ask!

  3. donde comprar viagra sin receta
    buy viagra canada viagra pills
    can you take viagra with antibiotics

  4. what drugs are contraindicated with viagra
    women’s testimionial when taking viagra
    how long do most men stay erect with viagra

  5. viagra 100mg street price
    <a href="">viagra without a doctor prescription</a>
    how many men over 60 take viagra

  6. I am sure this paragraph has touched all the internet people, its really really nice paragraph on building up new webpage.

  7. viagra 100mg street value
    <a href=>buy viagra online canada</a>
    how hard is it to get a presription for viagra

  8. how do i take viagra to get the best results
    where to buy viagra online viagra without doctor prescription
    what is the cost per pill of viagra with cvs

  9. viagra dose for 270 lbs
    cheapest viagra best online pharmacy for viagra
    where to buy cheap viagra 100mg online without prescription

  10. I’ve been surfing on-line greater than 3 hours today, but I by no means discovered any interesting article like yours. It is pretty price sufficient for me. In my view, if all website owners and bloggers made good content as you probably did, the net can be much more helpful than ever before.

  11. Greetings! Very helpful advice within this post! It is the little changes that make the biggest changes. Thanks a lot for sharing!

  12. where can i find samples of viagra today
    <a href=>when to buy viagra</a>
    how do they reverse viagra

  13. is viagra and sildenafil the same
    <a href="">where to buy viagra online</a>
    premature ejaculation 2 minutes on viagra less than 1 minute without

  14. Incredible! This blog looks just like my old one! It’s on a completely different subject but it has pretty much the same page layout and design. Outstanding choice of colors!

  15. she said no after i took viagra
    buy viagra viagra pills
    does georgia require a video cosultation for viagra

  16. using viagra after gastric bypass surgery
    viagra pills viagra without doctor prescription
    where can i buy viagra without prescription

  17. how does viagra work and what are the side effects
    viagra without doctor prescription online viagra
    closest thing to viagra

  18. Hi, i think that i saw you visited my site thus i came to "return the favor".I’m attempting to find things to improve my web site!I suppose its ok to use a few of your ideas!!

  19. will a 25mg daily dose of viagra help ed
    <a href=>viagra vs cialis</a>
    can you take viagra with high blood pressure

  20. what is a substitute for viagra
    what is the normal milligram dosage of viagra prescribed
    viagra recetesiz satilir mi

  21. how to get viagra predcription cheaper on medicaid
    gayfuror viagra
    what would happen if you insert viagra into head of penis

  22. how long does viagra expire
    generic viagra buy viagra online
    what over the counter drug is similar to viagra

  23. These are truly fantastic ideas in concerning blogging. You have touched some fastidious things here. Any way keep up wrinting.

  24. when is the generic for viagra available
    sildenafil online cialis
    how can i buy viagra online without a prescription?

  25. how much does one viagra pill cost
    viagra 100mg cialis generic
    at what point should a man consider viagra

  26. what schedule drug is viagra
    <a href=>viagra prices</a>
    how much water to drink with viagra

  27. generic viagra soft tabs 100mg
    buy cialis online cialis generic
    where to get viagra today

  28. who makes the generic viagra
    viagra sale cialis 20mg
    premature ejaculation 2 minutes on viagra less than 1 minute without

  29. what do doctors do for viagra erection over 4 hours
    <a href="">viagra cheap</a>
    viagra after prostatectomy

  30. viagra replacement pills rite aid
    <a href=>cialis generic</a>
    when to start viagra after prostatectomy

  31. natural viagra for womenhow to use viagra for first time
    generic viagra canada price viagra without doctor prescriptionbuy cialis online
    cheap viagra pills onlineviagra porn videos

  32. what does viagra goes for on the street
    female viagra pillsgeneric sildenafil cialis vs viagracialis tadalafil
    viagra how long does it lastwhat store to get viagra

  33. how long does it take to get a prescription of viagra
    <a href=>viagra online</a>
    what is the cost of 30 viagra at walmart

  34. Hi would you mind stating which blog platform you’re using? I’m looking to start my own blog soon but I’m having a difficult time choosing between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design and style seems different then most blogs and I’m looking for something unique. P.S Apologies for being off-topic but I had to ask!

  35. can i take viagra while on amlodipine atenolol lisinopril and atorvastatin
    tadalafil tablets viagra dosage
    how much is a bottle of viagra

  36. how long will viagra work for how long does viagra stay in your system
    viagra samples generic viagra sildenafil citrate sildenafil coupon
    buy generic 100mg viagra online

  37. how long before viagra works how often can i take viagra
    tadalafil without a doctor’s prescription buy sildenafil citrate 100mg online viagra 100mg
    lowest price viagra

  38. when will viagra be generic
    cialis without a doctor’s prescription cialis prices
    how much bigger does viagra make a flaccid penis how long a window for having sex on viagra

  39. what would happen if a person crushed and snorted viagra rite aid viagra price
    viagra without a doctor prescription from canada cialis price generic viagra trusted pharmacy cialis 5mg
    viagra commercial women

  40. how do you take liquid viagra
    generic cialis canada pharmacy free viagra samples canadian pharcharmy online viagra viagra online canada pharmacy
    caremore formulary 2019 does it cover viagra, cialis what happens if you take viagra daily

  41. what works faster viagra or cialis how many times per day can you take viagra
    natural viagra substitute viagra canada online pharmacy viagra without a doctor prescription tadalafil cialis
    viagra doesn’t work cheap viagra online

  42. can you buy viagra in mexico se puede tomar viagra despues de un cateterismo
    cialis online generic tadalafil viagra professional
    riding viagra erection does viagra help with ejaculation

  43. do men who take viagra have orgasms how many errections can i have with viagra
    viagra erection after ejaculation generic viagra online pharmacy sildenafil generic cialis canada
    how much do 100mg viagra go for on the street

  44. viagra overdose treatment how to get a viagra sample
    cost of viagra generic viagra canada price
    pornstars stomach issues from viagra what kind of doctor can prescribe viagra

  45. how does viagra affect a woman over the counter alternatives to viagra
    natural viagra alternatives that work sildenafil citrate
    viagra after hernia surgery viagra canada online

  46. can you take viagra with antibiotics aking viagra under 18
    viagra vs cialis viagra generic availability viagra without a doctor prescription from canada
    where to buy viagra pearland home remedy viagra

  47. who is viagra for
    tadalafil 20 mg sildenafil 20 mg tablet cheap viagra sildenafil 20 mg tablet vs viagra
    how do you tell the dosage of viagra

  48. does walmart sell viagra drogas don saludero_viagra en colombia precio
    tadalafil cialis online viagra viagra for women
    viagra how long what is the cheapest viagra substitute there is

  49. viagra sports performance enhancer
    sildenafil 20 mg vs viagra cialis side effects sildenafil 20 mg
    flomax and viagra interaction

  50. how do you know if its safe to take viagra fastest way to get a viagra prescription
    sildenafil 20 mg vs viagra cialis side effects sildenafil 20 mg
    viagra generic price viagra prescription discounts

  51. [url=
    ]want to buy viagra online
    ]can i buy viagra online from canada
    ]buy viagra in canada
    ]buy viagra in canada legally
    ]online prescription viagra buy online

  52. katie cummings viagra brother
    canada pharmacy viagra generic viagra pills
    guy squirt blood penis injecting viagra

  53. does viagra help pe how can i get free viagra samples <a href=>why was viagra patent extended</a> what competes with viagra can i take one half viagra how viagra works and side effects

  54. [url=]buy viagra without consultation uk
    [url=]buy viagra cheapest price
    [url=]do i need prescription to buy viagra canada
    [url=]what states buy the most viagra
    [url=]can you buy viagra off the shelf

  55. [url=]buy antibiotics and viagra online no script cheap
    [url=]is it legal to buy viagra from canada
    [url=]what is the best site to buy generic viagra
    [url=]buy viagra in store
    [url=]viagra safe buy over internet paypal

  56. viagra caseiro viagra action <a href=>how many mg of viagra should one take.</a> what happens if a girl takes a viagra viagra para la mujer compuesto

  57. how often should i take viagra pharmacy express viagra how does viagra do anything if you dont have ed <a href=>what happens if you overdoes on viagra</a> viagra not working for performance anxiety viagra natural alternatives renal and viagra

  58. <a href=>when can you buy generic viagra
    </a> <a href=>buy keyword qoclick com viagra
    </a> <a href=>viagra nz buy
    </a> <a href=>buy viagra online from australia
    </a> <a href=>buy viagra online fedex delivery

  59. viagra boots <a href=>how to buy geneeic viagra</a> how do i get viagra without going to the doctor?

  60. he f**** her after taking viagra mexican viagra price <a href=>viagra unreliable what next</a> how much does a 100mg viagra cost viagra in a cage

  61. does viagra stop you coming early what is viagra made out of <a href=>how long does viagra work</a> viagra over the counter usa viagra paypal us

  62. <a href=>where can you buy generic viagra in alexandria va
    </a> <a href=>buy viagra online with out prescriptions
    </a> <a href=>buy real viagra online paypal accepted
    </a> <a href=>buy viagra in malaysia
    </a> <a href=>buy viagra australia online

  63. what was viagra initially used for how much horney goat weed equals one viagra <a href=>blue pill viagra</a> make natural viagra where to buy viagra tablets

  64. does viagra keep you hard after coming? <a href=>viagra movie</a> other pills like viagra

  65. what happens if your dog eats a 100 mg viagra how to get viagra from your doctor symptoms of taking viagra <a href=>blue facebook pill report</a> viagra government funding snopes how to order generic viagra online how much how many erections from a dose of viagra

  66. pushhealth viagra viagra for heart disease what does viagra look like <a href=>citrate sildenafil</a> is viagra a controlled substance

  67. when did viagra come out how long does it take for erection after taking viagra viagra erowid <a href=>viagra side effects men</a> when viagra generic

Leave a Reply

Your email address will not be published. Required fields are marked *

Human Verification: In order to verify that you are a human and not a spam bot, please enter the answer into the following box below based on the instructions contained in the graphic.