--字串功能 --substring print substring('iamagoodperson',1,5) select substring('iamagoodperson',1,5) --upper select upper('he is a good person') --lower select LOWER('this is an VERY interesting job') --ltrim select ltrim(' i am a good person')
如何縮小MSSQL的記錄檔已經是一個經常性的問題了,不過這個問題在精華區已經有不少答案了,我這裡也不再贅述。現在我們討論一下治本的問題,即如何使記錄檔不再增大?先介紹一個簡單的方法。就是把資料庫的故障還原模型設定為“簡單”(SQL2K)。這樣它就會在Checkpoint的時候截斷日誌。具體操作方法是:1、在Enterprise Manager中右鍵點資料庫,“屬性|選項|故障還原”,選擇“簡單”就可以了,如果是SQL7,在“屬性|選項”中有一個“trunc. log on chkpt.
If you are trying to install SQL Server 2005 Express edition in Windows SP3 environment, it will most likely fail unless Microsoft has done something to fix this. Read through this blog to find how to get around with this issue.Symptoms include SQL
一段trigger codes例子: 插入、刪除和更新的觸發器代碼:Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->-- dbo.trGroups.SQL IF EXISTS ( SELECT * FROM sysobjects WHERE name = 'trGroups' AND type = 'TR')BEGIN
文章目錄 修改欄位UPDATETEXT:讀欄位READTEXT: SQL Server 2000專門提供了處理text,ntext,image欄位的函數,他們是:TEXTPTRTEXTVALIDREADTEXTUPDATETEXTWRITETEXT一般作用方法:寫欄位WRITETEXT :DECLARE @val varbinary(16)SELECT @val = TEXTPTR(欄位名) FROM 表名 where
--需求說明: /* id col ---------- ---------- AB00001 a AB00002 b --當再插入資料的時候讓id自動變成AB00003 */ --1.求最大值法(高並發時不適用,只是介紹個思路) --測試資料 if object_id('[macotb]') is not null drop table [macotb] create table [macotb] (id varchar(
SET QUOTED_IDENTIFIER ON GOSET ANSI_NULLS OFF GOcreate procedure sp_password @old sysname = NULL, -- the old (current) password @new sysname, -- the new password @loginame sysname = NULL -- user to change password
通過SQL Server的位元運算功能巧妙解決多選查詢 項目中很多業務對象的資料表中都具有Status欄位,有人使用int型儲存Status,有人使用varchar型。無論使用int還是varchar,對於Status的多選查詢都是不易應對的。舉例,常規思維下對CustomerStatus的Enum設定如下: [Serializable] public enum CustomerStatus { New = 0, Active =
--檢測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