The connection string to use with PHP, dblib and SQL Server

If you are trying to connect to an SQL Server database with the dblib drivers for PDO, this is the correct connection string to use: new PDO(‘dblib:host=’.$host.’;dbname=’.$database, $this->user, $this->password); You can also specify the encoding with charset=UTF-8 or charset=ISO-8859-1 if necessary. Be aware that dblib is incredibly buggy and that it does not support unicode […]

SQL Server: How to add a month to the current date

If you want to add a month to the current date in SQL Server, use the DATEADD function. In this example, we add 1 month to the current date by combining it with GETDATE(): DATEADD(mm,1,GETDATE()) In this second example, we add two months to a date from another column called other_column: DATEADD(mm,2,other_column) You can use […]