SQL Server 笔记

1.判断临时表存在则删除

--知识点:必须添加“tempdb..”
IF OBJECT_ID( 'tempdb..##TEMP_COPTD') IS NOT NULL
Begin 
DROP TABLE ##TEMP_COPTD
End 

 

2.工具SSMS2008及以上的代码提示功能如何刷新本地缓冲 

--写SQL时代码提示中没有新建的数据表、字段等提示时,刷新本地缓冲解决。
--快捷键 CTRL+SHIFT+R 即可
--菜单“编辑->IntelliSense->刷新本地缓存"

 

3.“库对库”操作需要先开启服务

  SQL Server数据库远程操作中,在使用openrowset/opendatasource前首先要启用Ad Hoc Distributed Queries服务,因为这个服务不安全所以SqlServer默认是关闭的。

--开启
EXEC sp_configure 'show advanced options',1  
reconfigure 
EXEC sp_configure 'Ad Hoc Distributed Queries',1 
reconfigure 
--关闭
EXEC sp_configure 'Ad Hoc Distributed Queries',0  
reconfigure  
EXEC sp_configure 'show advanced options',0  
reconfigure 

 

posted on 2018-02-11 16:28  ThinPro  阅读(133)  评论(0)    收藏  举报

导航