php调用sqlserver数据库



freetsd 安装
        a: tar zxvf freetds-stable.tgz
        b: cd freetds-0.91/
        c: ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib
        d: make
        e: make install
        f: vim /etc/ld.so.conf
        添加以下行:
        /usr/local/freetds/lib
        g: ldconfig
        h: vim /usr/local/freetds/etc/freetds.conf
        查找:
        [global]
        # TDS protocol version
        tds version = 4.2
        修改为  tds version = 7.0 去掉前面的分号
        i: /usr/local/freetds/bin/tsql -H 172.1.1.0 -p 1433 -U database_name
        能连上说明安装成功

 mssql 扩展安装

        a: unzip mssql.zip
        b: cd mssql
        c: /usr/local/opt/php/bin/phpize
        d: ./configure --with-php-config=/usr/local/opt/php/bin/php-config  --with-mssql=/usr/local/freetds/
        e: make
        f: make install
        g: vim /usr/local/etc/php/php.ini
                添加 extension=mssql.so
        g: /usr/local/opt/php/bin/php  -m |grep mssql
        查到mssql说明安装成功

常用的sqlserver语句

     1:查询数据库

         1> use master
         2> select [name] from [sysdatabases] order by [name]
         3> go

      2:查询数据表

        1> select * from information_schema.columns where table_name='tbl_smsendtask'
        2> go



阅读更多
换一批

没有更多推荐了,返回首页