PIXNET Logo登入

DanBrother的部落格

跳到主文

歡迎光臨DanBrother在痞客邦的小天地. 部落格文章同步於=> http://blog.xuite.net/gem083/dba

部落格全站分類:數位生活

  • 相簿
  • 部落格
  • 留言
  • 名片
  • 3月 14 週一 201615:19
  • Encrypting and Decrypting a Stored Procedure (T-SQL)

Encrypting and Decrypting a Stored Procedure (T-SQL)
 
-- Create a stored procedure named "sp_test_encryption"
create procedure sp_test_encryption
with encryption
as
 print 'This stored procedure has been encrypted!'
GO
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(138)

  • 個人分類:SQL SERVER
▲top
  • 5月 11 週一 201510:47
  • How to Increase the Maximum allowed Attachment File Size for email using sp_send_dbmail

How to Increase the Maximum allowed Attachment File Size for email using sp_send_dbmail
Solution:
[Method 1]
(Within SQL Server Management Studio)
Management -> Database Mail -> Configure Database Mail
-> Next -> View or change system parameters -> Maximum File Size (Bytes) : 1000000 => 5000000
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(8)

  • 個人分類:SQL SERVER
▲top
  • 12月 16 週二 201418:06
  • How to login to SQL Server with different OS account?

How to login to SQL Server with different OS account?
Solution:
runas /user:domain\new_user "C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\Ssms.exe"

e.g.
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(8)

  • 個人分類:SQL SERVER
▲top
  • 11月 25 週二 201418:34
  • Query First and Last Datetime of This Month (T-SQL)

Query First and Last Datetime of This Month (T-SQL):
DECLARE @now datetime
DECLARE @first_dt datetime
DECLARE @last_dt datetime
DECLARE @first_dt_concat varchar(30)
DECLARE @last_dt_concat varchar(30)
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(12)

  • 個人分類:SQL SERVER
▲top
  • 11月 20 週四 201415:12
  • Partitioned Table and Index Creation Example (SQL Server 2005 and up)

testdb_table_usagePartitioned Table and Index Creation Example (SQL Server 2005 and up)

USE [testdb]
GO
ALTER DATABASE testdb ADD FILEGROUP [YEAR_2011]
ALTER DATABASE testdb ADD FILEGROUP [YEAR_2012]
ALTER DATABASE testdb ADD FILEGROUP [YEAR_2013]
ALTER DATABASE testdb ADD FILEGROUP [YEAR_2014]
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(13)

  • 個人分類:SQL SERVER
▲top
  • 10月 31 週五 201417:48
  • Restore SQL Server Database Examples

(1) Restore SQL Server Database With Replace, Recovery Option

use master
go
alter database testdb set offline with rollback immediate
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(15)

  • 個人分類:SQL SERVER
▲top
  • 8月 28 週四 201414:58
  • Let SQL Server tell you which indexes need to rebuild

Let SQL Server tell you which indexes need to rebuild
Here's the SQL script:
SELECT 'ALTER INDEX [' + ix.name + '] ON [' + s.name + '].[' + t.name + '] ' +
CASE
WHEN ps.avg_fragmentation_in_percent > 15 THEN 'REBUILD'
ELSE 'REORGANIZE'
END +
CASE
WHEN pc.partition_count > 1
THEN ' PARTITION = ' + CAST(ps.partition_number AS nvarchar(MAX))
ELSE ''
END,
avg_fragmentation_in_percent
FROM sys.indexes AS ix
INNER JOIN sys.tables t
ON t.object_id = ix.object_id
INNER JOIN sys.schemas s
ON t.schema_id = s.schema_id
INNER JOIN
(SELECT object_id ,
index_id ,
avg_fragmentation_in_percent,
partition_number
FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL, NULL)
) ps
ON t.object_id = ps.object_id
AND ix.index_id = ps.index_id
INNER JOIN
(SELECT object_id,
index_id ,
COUNT(DISTINCT partition_number) AS partition_count
FROM sys.partitions
GROUP BY object_id,
index_id
) pc
ON t.object_id = pc.object_id
AND ix.index_id = pc.index_id
WHERE ps.avg_fragmentation_in_percent > 10
AND ix.name IS NOT NULL;
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(15)

  • 個人分類:SQL SERVER
▲top
  • 4月 02 週三 201414:34
  • A quick way to run multiple SQL files of MSSQL

A quick way to run multiple SQL files of MSSQL
Suppose we have multiple SQL files of MSSQL to be executed.
Here's a quick way to do that.
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(10)

  • 個人分類:SQL SERVER
▲top
  • 3月 17 週一 201413:54
  • SQL Server - sqlcmd example

SQL Server - sqlcmd example
usage: Sqlcmd [-U login id] [-P password]
[-S server] [-H hostname] [-E trusted connection]
[-N Encrypt Connection][-C Trust Server Certificate]
[-d use database name] [-l login timeout] [-t query timeout]
[-h headers] [-s colseparator] [-w screen width]
[-a packetsize] [-e echo input] [-I Enable Quoted Identifiers]
[-c cmdend] [-L[c] list servers[clean output]]
[-q "cmdline query"] [-Q "cmdline query" and exit]
[-m errorlevel] [-V severitylevel] [-W remove trailing spaces]
[-u unicode output] [-r[0|1] msgs to stderr]
[-i inputfile] [-o outputfile] [-z new password]
[-f <codepage> | i:<codepage>[,o:<codepage>]] [-Z new password and exit]
[-k[1|2] remove[replace] control characters]
[-y variable length type display width]
[-Y fixed length type display width]
[-p[1] print statistics[colon format]]
[-R use client regional setting]
[-b On error batch abort]
[-v var = "value"...] [-A dedicated admin connection]
[-X[1] disable commands, startup script, enviroment variables [and exit]]
[-x disable variable substitution]
[-? show syntax summary]
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(881)

  • 個人分類:SQL SERVER
▲top
  • 11月 20 週三 201318:19
  • Database Migration Steps from SQL Server 2000 to SQL Server 2005 or 2008

Database Migration Steps from SQL Server 2000 to SQL Server 2005 or 2008
Source Database [SQL Server 2000]
1. Backup the Database (mydb) to mydb.BAK file
(繼續閱讀...)
文章標籤

DanBrother 發表在 痞客邦 留言(0) 人氣(29)

  • 個人分類:SQL SERVER
▲top
12»

廣告

個人資訊

DanBrother
暱稱:
DanBrother
分類:
數位生活
好友:
累積中
地區:

熱門文章

  • (49,256)Excel 2007 中文字顯示亂碼之修復步驟
  • (136)crsctl command usage
  • (83)ORA-15306: ASM Password File Update Failed On At Last One Node
  • (542)Workaround for NI cryptographic checksum mismatch error: 12599 (TNS-12599)
  • (1,847)FRM-91111 and FRM-10039 When Starting Oracle Forms Builder 11g on Linux
  • (21)PL/SQL BULK COLLECT Using LIMIT Clause Practice
  • (3,644)[OHS-2171] NZ Library Error: SSL negotiation error [Hint: too restrictive SSLCipherSuite]
  • (41)OPatch failed with error code 73 (Solved)
  • (137)Oracle HTTP Server 12c (12.1.3) standalone installation Procedures on Linux
  • (784)如何讓樞紐分析表區分大小寫

文章分類

  • Android (1)
  • Java (1)
  • MongoDB (1)
  • MariaDB (7)
  • Python (10)
  • HTML (1)
  • ORDS (1)
  • Apache Tomcat (1)
  • Oracle Streams (1)
  • Javascript (1)
  • Oracle Data Guard (2)
  • Oracle VirtualBox (3)
  • Grid Infrastructure (4)
  • Oracle SQL Tuning (6)
  • OEM11g / 12c (28)
  • IT Links (1)
  • 心靈饗宴 (161)
  • Oracle Clusterware (5)
  • ORACLE RAC (21)
  • Oracle ASM (18)
  • Oracle Export/Import (10)
  • MySQL (22)
  • Windows Series (18)
  • Oracle HTTP Server (8)
  • Linux (49)
  • Microsoft Office (6)
  • SQL SERVER (19)
  • Install Apache & PHP (2)
  • Oracle in General (111)
  • RMAN (15)
  • SQL / PL/SQL (30)
  • 未分類文章 (1)

最新文章

  • MySQL Array Simulation in Stored Procedure
  • Extracts, orders, and then prints grants for MySQL user accounts (pt-show-grants)
  • MySQL Stored Procedure - Nested Loop Example
  • Metabase H2 DB Migration to MySQL 5.7
  • Steps for Upgrading Percona-Toolkit to the Latest Version
  • MySQL Slave - Skip Replication for A Particular Table
  • MySQL - Export & Import Table Data Based on the SQL Query
  • MySQL Table Fragmentation Detection and De-fragmentation Implementation
  • Multiple Log File Viewer (Linux Bash)
  • Solving MySQL slave lag Issues

動態訂閱

文章精選

文章搜尋

誰來我家

參觀人氣

  • 本日人氣:
  • 累積人氣:

留言板