2016年3月31日 星期四

讓Hyper-V和VMware、VirtualBox等共存

關閉hypervisor:
bcdedit /set hypervisorlaunchtype off

啟用hypervisor:
bcdedit /set hypervisorlaunchtype auto
關閉和啟用指令於命令提示字元執行後須重開機才會生效

啟用hypervisor之後:

關閉hypervisor之後:



在VMware虛擬機的vmx檔最後加入
vmx.allowNested = TRUE
再啟用hypervisor
就可以同時啟動Hyper-V和VMware的虛擬機


REF:
如何同時安裝使用 Hyper-V 與 VMware
設定開機選項選擇使用 VMWare 或 Hyper-V
Switch off Hyper-V without disable functionality in Windows 8.1

2016年3月28日 星期一

TSQL換行符號

CHAR(13)

儲存TSQL執行過程的@@ERROR (@@ERROR =0 )

儲存TSQL執行過程的@@ERROR (@@ERROR <>0 )



SELECT * FROM sys.sysmessages WHERE msglangid=1028 AND error = 8134

2016年3月26日 星期六

System Tables (Transact-SQL)

https://msdn.microsoft.com/en-us/library/ms179932.aspx

T-SQL變數宣告

Data Types (Transact-SQL)
https://technet.microsoft.com/en-us/library/ms187752(v=sql.105).aspx






Built-in Functions (Transact-SQL)

https://msdn.microsoft.com/en-us/library/ms174318(v=SQL.110).aspx

在SSMS查詢微軟網站說明

選取關鍵字(比如SELECT)之後按下F1 (Shift+F1也可)
就會開啟瀏覽器連到微軟網站說明

SQL Server、Unicode、雙位元字(DBCS)

SQL Server 6.5之前不支援雙位元字(DBCS Code Page),需手動安裝 DBCS Code Page
SQL Server7.0之後才支援Unicode


Default code page for SQL Server:
https://support.microsoft.com/en-us/kb/153449
SQL Server 4.21a => code page 850 (Multilingual)
SQL Server 6.0 and 6.5 => ISO 8859-1 (Latin 1 or ANSI), 也就是 code page 1252


DBCS(double-byte character set) code page:cp-932、cp-936、cp-949、cp-950
Local                LCID          Code Page
--------------------------------------------
Chinese (PRC)        0x0804           936
Chinese (Taiwan)     0x0404           950
Chinese (Hong Kong)  0x0c04           950
Chinese (Singapore)  0x1004           936
Japanese             0x0411           932
Korean               0x0412           949

INF: Installing a DBCS Code Page for SQL Server
http://www.c-bit.org/kb/165051/EN-US/

SQL Server處理Unicode字串時,前置詞"N"之使用
http://eportfolio.lib.ksu.edu.tw/~A093000085/blog?node=000000009

2016年3月23日 星期三

diruse下載點

http://download.microsoft.com/download/win2000platform/diruse/1.00.0.1/NT5/EN-US/diruse_setup.exe

ref:
Diruse command line utility
Diruse Syntax

其他類似工具:
Disk Usage
TreeSize Free
WinDirStat

Sysinternals File and Disk Utilities:
https://technet.microsoft.com/en-us/sysinternals/bb545046.aspx

Work around Sysinternals license pop-ups
https://peter.hahndorf.eu/blog/WorkAroundSysinternalsLicenseP.html

Keyword:
EulaAccepted、[HKEY_CURRENT_USER\Software\Sysinternals\]、HKCU、監控資料夾大小

2016年3月22日 星期二

sys.sysmessages


select msglangid,* from sys.sysmessages where error = '207'

不同語系的錯誤訊息



sys.syslanguages

select msglangid,* from sys.syslanguages
msglangid為1028是繁體中文


Table Scan和Index Scan

Table Scan沒有順序
Index Scan有順序

one clustered index per table

一個資料表只能有一個叢集索引

備註:
一個資料表可以有多個非叢集索引(nonclustered indexes)

In SQL Server, indexes are organized as B-trees.
Nonclustered indexes have the same B-tree structure as clustered indexes,
https://technet.microsoft.com/en-us/library/ms177443(v=sql.105).aspx


ref:
Clustered Index Structures
Nonclustered Index Structures

2016年3月20日 星期日

DBCC CHECKIDENT(testRESEED, RESEED, 1)

DBCC CHECKIDENT(testRESEED, RESEED, 1)
testRESEED為Table名稱
將testRESEED這資料表的索引值,改為從1開始計算
以下insert紅框處,id變成2

2016年3月6日 星期日

SET IDENTITY_INSERT ON

先關閉自動取號
所以insert語法需要加id
一次只能ON一個TABLE
結束後使用SET IDENTITY_INSERT OFF

錯誤訊息:
當 IDENTITY_INSERT 設為 OFF 時,無法將外顯值插入資料表 'Products' 的識別欄位中
(Cannot insert explicit value for identity column in table 'Products' when IDENTITY_INSERT is set to OFF.)


REF:
https://msdn.microsoft.com/en-us/library/ms188059.aspx
http://blog.xuite.net/linriva/blog/35114164-%5BSQL+Server%5D+SET+IDENTITY_INSERT%3ARe-Insert
測試語法:

CTE和子查詢的效能

CTE(Common Table Expressions)和子查詢(subquery)的效能是一樣的
只是CTE語法比較有結構性,會比較好維護

P.S.從SQL Server 2005之後新增CTE語法

REF:
Recursive Queries Using Common Table Expressions
https://msdn.microsoft.com/en-us/library/ms186243(v=SQL.110).aspx

T-SQL -- COMMON TABLE EXPRESSION (CTE) 教學重點筆記
http://blog.kkbruce.net/2011/01/t-sql-common-table-expression-cte.html#.VtxCA7Z96Uk

2016年3月3日 星期四

2016年3月2日 星期三

Java Incompatibilities

Compatibility Guide for JDK 8
http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html

Java SE 7 and JDK 7 Compatibility
http://www.oracle.com/technetwork/java/javase/compatibility-417013.html

Oracle Java SE Support Roadmap
http://www.oracle.com/technetwork/java/eol-135779.html

Java SE 7 End of Public Updates Notice
https://java.com/en/download/faq/java_7.xml

Incompatibilities in the Java Platform, Standard Edition 6   (since J2SE 5.0)
http://www.oracle.com/technetwork/java/javase/compatibility-137541.html#incompatibilities

Incompatibilities in the Java 2 Platform, Standard Edition, v1.4.2   (since 1.4.1)
http://www.oracle.com/technetwork/java/javase/compatibility-142878.html#incompatibilities

Incompatibilities in J2SE 1.4.1   (since 1.4.0)
http://www.oracle.com/technetwork/java/javase/compatibility-j2se1-140308.html

Incompatibilities in J2SE 1.4.0   (since 1.3)
http://www.oracle.com/technetwork/java/javase/compatibility-j2se1-141394.html

Incompatibilities in J2SE 1.3   (since 1.2)
http://www.oracle.com/technetwork/java/javase/compatibility-135119.html

Is your project ready for Java 7?
http://vyazelenko.com/2012/02/01/is-your-project-ready-for-java-7/

Is JDK “upward” or “backward” compatible?
http://stackoverflow.com/questions/4692626/is-jdk-upward-or-backward-compatible


keyword:
java Incompatibilities、java Compatibility Guide