+(defmethod read-sql-value (val (type (eql 'boolean)) database
+ (db-type (eql :mssql)))
+ (declare (ignore database))
+ (etypecase val
+ (string (if (string= "0" val) nil t))
+ (integer (if (zerop val) nil t))))
+
+(defmethod read-sql-value (val (type (eql 'generalized-boolean)) database
+ (db-type (eql :mssql)))
+ (declare (ignore database))
+ (etypecase val
+ (string (if (string= "0" val) nil t))
+ (integer (if (zerop val) nil t))))
+
+;;; Type methods
+
+(defmethod database-get-type-specifier ((type symbol) args database
+ (db-type (eql :mssql)))
+ "Special database types for MSSQL backends"
+ (declare (ignore database db-type args))
+ (case type
+ (wall-time "DATETIME")
+ (date "SMALLDATETIME")
+ ((generalized-boolean boolean) "BIT")
+ ((longchar text) "ntext")
+ ((varchar string)
+ (if args
+ (format nil "NVARCHAR(~A)" (car args))
+ (format nil "NVARCHAR(~D)" *default-string-length*)))
+ (t (call-next-method))))
+
+;;; Generation of SQL strings from lisp expressions
+
+(defmethod database-output-sql ((tee (eql t)) (database generic-odbc-database))
+ (case (database-underlying-type database)
+ (:mssql "1")
+ (t "'Y'")))
+
+;;; Database backend capabilities
+
+(defmethod db-type-use-fully-qualified-column-on-drop-index? ((db-type (eql :mssql)))
+ t)
+
+(defmethod db-type-has-boolean-where? ((db-type (eql :mssql)))
+ nil)
+
+(defmethod db-type-has-intersect? ((db-type (eql :mssql)))
+ nil)
+
+(defmethod db-type-has-except? ((db-type (eql :mssql)))
+ nil)
+