顯示具有 MSSQL 標籤的文章。 顯示所有文章
顯示具有 MSSQL 標籤的文章。 顯示所有文章

2019年7月1日 星期一

做過的事,很快就忘..<是該記錄一下!!>.


今天要做一個過濾的動作,將新的暫存 Table (A)  及舊的Table (B) 做一個過濾的動作,取得存在於暫存Table 但不在舊 Table 上的新資料。
找到有人整理清析的說明圖,一目了然!

Select <xxx>
From Table A (從暫存Table A中)
Left Join Table B (加入舊Table B的項目)
on A.key = B.key (設定 A、B Table 相等的是Key )
Where B.key is null (只取 B  Table Key 值是空的,即刪除A、B重疊的項目的意思)





完整參考如下:
https://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins

2012年3月23日 星期五

壓縮SQL Server的Transation Log


記錄一下..免得久久找一次.
有用的方法來抑制SQL DB的Log快速成長:
1. 不重要的DB,將Recovery Mode 改為Simple:DB->properties->options (自動記錄截斷)
2. 壓縮Transaction Log DB:
壓縮SQL Server的Transation Log(交易記錄檔)
USE <DB_NAME>   --<DB_NAME>:資料庫名稱
DBCC SHRINKFILE([<DB_NAME>_log],2)    --<DB_NAME>_log:ldf檔的邏輯檔名

Ex: 壓縮OCS DB的Log
USE OCSDB
DBCC SHRINKFILE(OCSDB_log],2)

更多說明可看出處:http://msdn.microsoft.com/zh-tw/library/ms345583.aspx

2011年12月27日 星期二

新建的MSSQL無法用SA登入

今天測試MS SQL時,一直無法順利登入,應該沒打錯呀..

檢查:
1. 使用Windows Authentication 登入,發現sa 圖示有向下箭頭,按右鍵屬性改為Enable.
2. 再試仍無法登入,錯誤為:Login failed for user 'sa'. (Microsoft SQL Server, Error: 18456)
Search 登入失敗的錯誤訊息,發現是MS SQL ->Server 屬性-> Security -> Server Authentication 的地方,指定使用"Windows Authentication mode",改為"SQL Server and Windows Authentica mode" 即可.