使用SQL Server變數的時候碰到變數名稱大小寫問題: 當前資料庫是大小寫不敏感的,但是聲明變數之後發現變數名稱是大小寫敏感的。一直認為SQL Server的變數名稱的Collcation是跟當前資料庫的,在MSDN:You cannot specify a collation for character variables and parameters; they are always created with the default collation of the database.
通常我們都需要查詢一個表的總行數,很多人都喜歡用select count(*) from Table.如果表資料非常大的話,這樣的查詢是很耗費時間和資源的。 其實有兩個辦法可以快速的查詢到SQL Server的表資料。1. sp_spaceused:其中有一列是rows,如果輸入的表對象的話,那麼就會獲得這個表的行數,速度非常快。 rowschar(11)表中現有的行數。如果指定的對象是 Service Broker
SQL Server Profiler 模板http://msdn.microsoft.com/zh-cn/library/ms190176.aspx 可以使用 SQL Server Profiler來建立模板,定義要包含在跟蹤中的事件類別和資料列。定義並儲存模板後,可以運行跟蹤來記錄每個選定事件類別的資料。您可以將一個模板用於多個跟蹤;模板本身並不會執行。SQL Server Profiler提供了預定義的跟蹤模板,使您可以輕鬆配置特定跟蹤可能最需要的事件類別。例如,Standard
Junior SQL Server Developer Interview Questions Written By: Jeremy Kadlec from: http://www.mssqltips.com/tip.asp?tip=1644 ProblemWe are in the process of trying to hire aJunior SQL Server Developer to work on a few of our
from http://www.mssqltips.com/tip.asp?tip=2045Using Hints To Test Indexes in SQL ServerWritten By: Ken Simmons -- 6/24/2010 -- 1 comments -- print -- free stuff -- ProblemWhen tuning indexes, it is somewhat difficult to tell how much impact the
最近在修bug的時候出現了一個問題,系統中會根據項目的多少動態去建立一個視圖來將所有項目的某些資料union到一起。當系統的項目數量超過256時,問題出現了。SQL Server會拋出如下異常: Msg 106, Level 15, State 1, Procedure vsp_T, Line 256Too many table names in the query. The maximum allowable is
常見的錯誤為: The Network Adapter could not establish the connection1 檢查SQL SERVER 是否允許遠端存取.具體步驟: 1)開啟"企業管理器",開啟控制台根目錄>SQL Server 組>資料庫 2)在相應"資料庫"上單擊右鍵,選擇"屬性"3)選擇"串連"選項卡,檢查"遠程伺服器串連"下,RPC服務是否選擇. 2 使用telnet IP地址 1433,系統是否提示串連出錯比如