Category Archives: Microsoft

Exchange Uncategorized

Exchange transaction logs

The Exchange transaction logs are 5 MB files that are used to ensure database integrity. When handling the storage of transaction log files, it is best to have separate mirrored disks that are dedicated for the storage of these files. The main advantage of this is that in the event of a disk failure the other mirrored disk will contain current logs that are necessary for the operation of the Exchange database.

The transaction log files tend to grow rapidly, especially if circular logging is disabled. This uses up a lot of disk storage space. Disabling circular logging, however, has its advantages, especially in the event that any of the Exchange database becomes corrupted. To reduce buildup of these logs, perform daily backups of the Exchange database.

If the Exchange server contains one disk that handles both the transaction logs and the Exchange database, and this disk becomes full DO NOT DELETE THE TRANSACTION LOGS. Perform a full database backup that will then flush out the old log files.

source: Adesh Rampat

ASP.Net

Upload de Ficheiros com ASP.Net

Excelente artigo sobre uploading de Ficheiros com ASP.Net

ASP.NET 2.0 FileUpload

http://www.codeguru.com/csharp/sample_chapter/article.php/c12593__3/

Por: Bill Evjen September 12, 2006

SQL Server

SUBSTRING (Transact-SQL)

Sintax: SUBSTRING ( expressão , início , fim )

Exemplo: Select SUBSTRING(“expressao”, 1, 5) = “expre”

read more »

SQL Server

Examples of how to Calculate Different SQL Server Dates

First Day of Month
select DATEADD(mm, DATEDIFF(mm,0,getdate()), 0)
Monday of the Current Week
select DATEADD(wk, DATEDIFF(wk,0,getdate()), 0)

set DATEFIRST 1

select DATEADD(dd, 1 – DATEPART(dw, getdate()), getdate())

First Day of the Year
select DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)
First Day of the Quarter
select DATEADD(qq, DATEDIFF(qq,0,getdate()), 0)
Midnight for the Current Day
Select DATEADD(dd, DATEDIFF(dd,0,getdate()), 0)
Last Day of Prior Month
select dateadd(ms,-3,DATEADD(mm, DATEDIFF(mm,0,getdate()Â ), 0))
Last Day of Prior Year
select dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate()Â ), 0))
Last Day of Current Month
select dateadd(ms,-3,DATEADD(mm, DATEDIFF(m,0,getdate()Â )+1, 0))
Last Day of Current Year
Select dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate()Â )+1, 0))
First Monday of the Month
select DATEADD(wk, DATEDIFF(wk,0,
           dateadd(dd,6-datepart(day,getdate()),getdate())
                              ), 0)    Â

Â

Â

Code Snippets ASP.Net Uncategorized

Convert Int16 to Bool

Convertendo um campo do tipo Int16 para Boolean em ASP.NET no ficheiro aspx ou ascx, para poder ser usado numa CheckBox, podemos utilizar o seguinte código:

<%# Convert.ToBoolean((DataBinder.Eval(Container.DataItem, "myInt16value")) )%>

IIS

IIS: Erro inesperado 0x8ffe2740

No prompt de comandos digite NETSTAT -AÂ e verifique qual o outro processo que deve estar usando a porta 80.
Pare o processo pelo gestor de tarefas ou configure no IIS para ele usar outra porta que não seja a 80.
se tiver o skype instalado, tente terminar o processo e reiniciar o IIS, comigo resultou 😉

ASP.Net

Formatar String

label1.Text = String.Format(“{0:0.00}”, valor)Â Â Â ->Â 9.56

label1.Text = String.Format(“{0:0.0}”, valor)Â Â Â ->Â Â 9.6

SQL Server

Somando Valores NULL

Select SUM(IsNull(Null,0) + IsNull(NULL,0)) AS valor     -> 0

Select SUM(IsNull(Null,0)) AS valor   -> 0

Select SUM(IsNull(Null,6)) AS valor   -> 6

SQL Server

Convertendo datas em texto

DateTime > varchar

Select convert(varchar(30),getdate(),100) > Mar 16 2007 3:06PM
Select convert(varchar(30),getdate(),101) > 03/16/2007
Select convert(varchar(30),getdate(),102) > 2007.03.16
Select convert(varchar(30),getdate(),103) > 16/03/2007
Select convert(varchar(30),getdate(),104) > 16.03.2007
Select convert(varchar(30),getdate(),105) > 16-03-2007
Select convert(varchar(30),getdate(),106) > 16 Mar 2007
Select convert(varchar(30),getdate(),107) > Mar 16, 2007
Select convert(varchar(30),getdate(),108) > 15:06:04
Select convert(varchar(30),getdate(),109) > Mar 16 2007 3:06:04:793PM
Select convert(varchar(30),getdate(),110) > 03-16-2007
Select convert(varchar(30),getdate(),111) > 2007/03/16
Select convert(varchar(30),getdate(),112) > 20070316
Select convert(varchar(30),getdate(),113) > 16 Mar 2007 15:06:04:793
Select convert(varchar(30),getdate(),114) > 15:06:04:793

The list of styles that can be used are:

Style IDÂ Style Type
Â
0 or 100Â mon dd yyyy hh:miAM (or PM)
101Â mm/dd/yy
102Â yy.mm.dd
103Â dd/mm/yy
104Â dd.mm.yy
105Â dd-mm-yy
106Â dd mon yy
107Â Mon dd, yy
108Â hh:mm:ss
9 or 109Â mon dd yyyy hh:mi:ss:mmmAM (or PM)
110Â mm-dd-yy
111Â yy/mm/dd
112Â yymmdd
13 or 113Â dd mon yyyy hh:mm:ss:mmm(24h)
114Â hh:mi:ss:mmm(24h)
20 or 120Â yyyy-mm-dd hh:mi:ss(24h)
21 or 121Â yyyy-mm-dd hh:mi:ss.mmm(24h)
126Â yyyy-mm-dd Thh:mm:ss.mmm(no spaces)
130Â dd mon yyyy hh:mi:ss:mmmAM
131Â dd/mm/yy hh:mi:ss:mmmAM

SQL Server Uncategorized

SQL Server Reserved Word

ADD                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ALL                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ALTER                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
AND                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ANY                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
AS                   => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ASC                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
AUTHORIZATION        => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
AVG                  => SQLSERVER7,
BACKUP               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
BEGIN                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
BETWEEN              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
BREAK                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
BROWSE               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
BULK                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
BY                   => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CASCADE              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CASE                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CHECK                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CHECKPOINT           => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CLOSE                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CLUSTERED            => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
COALESCE             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
COLLATE              =>              SQLSERVER2000 | SQLSERVER2005,
COLUMN               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
COMMIT               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
COMMITTED            => SQLSERVER7,
COMPUTE              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CONFIRM              => SQLSERVER7,
CONSTRAINT           => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CONTAINS             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CONTAINSTABLE        => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CONTINUE             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CONTROLROW           => SQLSERVER7,
CONVERT              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
COUNT                => SQLSERVER7,
CREATE               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CROSS                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CURRENT              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CURRENT_DATE         => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CURRENT_TIME         => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CURRENT_TIMESTAMP    => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CURRENT_USER         => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
CURSOR               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DATABASE             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DBCC                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DEALLOCATE           => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DECLARE              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DEFAULT              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DELETE               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DENY                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DESC                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DISK                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DISTINCT             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DISTRIBUTED          => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DOUBLE               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DROP                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DUMMY                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
DUMP                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ELSE                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
END                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ERRLVL               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ERROREXIT            => SQLSERVER7,
ESCAPE               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
EXCEPT               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
EXEC                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
EXECUTE              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
EXISTS               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
EXIT                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
FETCH                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
FILE                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
FILLFACTOR           => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
FLOPPY               => SQLSERVER7,
FOR                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
FOREIGN              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
FREETEXT             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
FREETEXTTABLE        => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
FROM                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
FULL                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
FUNCTION             =>              SQLSERVER2000 | SQLSERVER2005,
GOTO                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
GRANT                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
GROUP                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
HAVING               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
HOLDLOCK             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
IDENTITY             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
IDENTITYCOL          => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
IDENTITY_INSERT      => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
IF                   => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
IN                   => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
INDEX                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
INNER                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
INSERT               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
INTERSECT            => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
INTO                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
IS                   => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ISOLATION            => SQLSERVER7,
JOIN                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
KEY                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
KILL                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
LEFT                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
LEVEL                => SQLSERVER7,
LIKE                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
LINENO               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
LOAD                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
MAX                  => SQLSERVER7,
MIN                  => SQLSERVER7,
MIRROREXIT           => SQLSERVER7,
NATIONAL             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
NOCHECK              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
NONCLUSTERED         => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
NOT                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
NULL                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
NULLIF               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
OF                   => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
OFF                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
OFFSETS              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ON                   => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ONCE                 => SQLSERVER7,
ONLY                 => SQLSERVER7,
OPEN                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
OPENDATASOURCE       => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
OPENQUERY            => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
OPENROWSET           => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
OPENXML              =>              SQLSERVER2000 | SQLSERVER2005,
OPTION               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
OR                   => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ORDER                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
OUTER                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
OVER                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
PERCENT              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
PERM                 => SQLSERVER7,
PERMANENT            => SQLSERVER7,
PIPE                 => SQLSERVER7,
PLAN                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
PRECISION            => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
PREPARE              => SQLSERVER7,
PRIMARY              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
PRINT                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
PRIVILEGES           => SQLSERVER7,
PROC                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
PROCEDURE            => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
PROCESSEXIT          => SQLSERVER7,
PUBLIC               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
RAISERROR            => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
READ                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
READTEXT             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
RECONFIGURE          => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
REFERENCES           => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
REPEATABLE           => SQLSERVER7,
REPLICATION          => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
RESTORE              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
RESTRICT             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
RETURN               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
REVOKE               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
RIGHT                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ROLLBACK             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ROWCOUNT             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
ROWGUIDCOL           => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
RULE                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
SAVE                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
SCHEMA               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
SELECT               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
SERIALIZABLE         => SQLSERVER7,
SESSION_USER         => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
SET                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
SETUSER              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
SHUTDOWN             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
SOME                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
STATISTICS           => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
SUM                  => SQLSERVER7,
SYSTEM_USER          => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
TABLE                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
TAPE                 => SQLSERVER7,
TEMP                 => SQLSERVER7,
TEMPORARY            => SQLSERVER7,
TEXTSIZE             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
THEN                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
TO                   => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
TOP                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
TRAN                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
TRANSACTION          => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
TRIGGER              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
TRUNCATE             => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
TSEQUAL              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
UNCOMMITTED          => SQLSERVER7,
UNION                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
UNIQUE               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
UPDATE               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
UPDATETEXT           => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
USE                  => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
USER                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
VALUES               => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
VARYING              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
VIEW                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
WAITFOR              => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
WHEN                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
WHERE                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
WHILE                => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
WITH                 => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,
WORK                 => SQLSERVER7,
WRITETEXT            => SQLSERVER7 | SQLSERVER2000 | SQLSERVER2005,