From PostgreSQL to MSSQL

I love postgresql but my client request specifically for MSSQL.

1. PGSQL boolean column return ‘t’ and ‘f’ for true and false
MSSQL bit column return 1 and 0 for truen and false

2. PGSQL text column is special it can be use for any size of text
MSSQL varchar column to be able to use operator in where clause and varchar(max) for long string

3. PGSQL use pg_* functions
MSSQL use sqlsrv_* driver supplied by Microsoft and this driver can only be use in windows.

4. PGSQL pg_fetch_object return string for datetime column value
MSSQL sqlsrv_fetch_object return DateTime object for datetime column value.
I have to pass ‘ReturnDatesAsString’ option in the connection string to turn if off.

5. Paging in PGSQL is straight forward using LIMIT .. OFFSET
In MSSQL i have to use CTE function to enable to use my existing paging library.

6. PGSQL pg_affected_rows()
MSSQL sqlsrv_rows_affected()


Published by


Different. In a good way

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s