MSSQL Puzzles

访问其他数据库服务器

SQL默认阻止对组件Ad Hoc Distributed QueriesSTATEMENT OpenRowSet/OpenDatasource的访问,需要使用sp_configure 启用Ad Hoc Distributed Queries

  • 开启Ad Hoc Distributed Queries

    1
    2
    3
    4
    exec sp_configure 'show advanced options',1
    reconfigure
    exec sp_configure 'Ad Hoc Distributed Queries',1
    reconfigure
  • 关闭

    1
    2
    3
    4
    exec sp_configure 'Ad Hoc Distributed Queries',0
    reconfigure
    exec sp_configure 'show advanced options',0
    reconfigure

特殊语法

数据导入

  • mssql中换行符设置为\n表示的是\r\n,即永远无法单独 指定\n或者\r,尽量使用ASCII码0xXX表示

    1
    > bulk insert tbl_name from /path/to/file with (FILEDTERMINATOR="|", ROWTERMINATOR="0x0a");
Author

UBeaRLy

Posted on

2019-03-21

Updated on

2019-02-17

Licensed under

Comments