通過SQL Server的位元運算功能巧妙解決多選查詢 項目中很多業務對象的資料表中都具有Status欄位,有人使用int型儲存Status,有人使用varchar型。無論使用int還是varchar,對於Status的多選查詢都是不易應對的。舉例,常規思維下對CustomerStatus的Enum設定如下: [Serializable] public enum CustomerStatus { New = 0, Active =
同樣的命題在SQL Server 2005中,微軟發布了一個報表,可以直接查看,但是這個報表不能用於SQL Server 2000。 於是我就寫了下面這幾句話,可以返回同樣的結果。 create table tmp (name varchar(50),rows int,reserved varchar(50), data varchar(50),index_size varchar(50),unused varchar(50)) insert into tmp
--檢測CPU壓力的一個方法是計算運行狀態下的背景工作處理序數量,--通過執行如下的DMV查詢可以得到這個資訊SELECT COUNT(*) AS workers_waiting_for_cpu,t2.scheduler_idFROM sys.dm_os_workers AS t1, sys.dm_os_schedulers AS t2 WHERE t1.state='RUNNABLE' AND t1.scheduler_address = t2.scheduler_address AND
Detect Memory Bottleneck in SQL ServerBy : Kasim Wirama, MCDBA This article, I would like to give information about memory bottleneck at SQL Server. The easiest way to know whether your SQL Server undergoes memory bottleneck is by looking at Task
Introductionsp_who2 is a well known utility that shows what spids are currently executing. However the information it shows is relatively limited. For example, it only shows the type of command executing as SELECT, DELETE etc, with no reference to
接著上一章 當訂閱端長時間沒有連上,且同時在發布端有大量的insert語句,來看看: USE mysales_normalGOINSERT INTO [mysales_normal].[myinventory].[Vendor]SELECT addressid,substring(addressline1,1,20),substring(city,1,10),substring(city,1,10),substring(city,1,5),substring(city,1,10) FROM