Author Archives: admin

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

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 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,

Opening .exe Attachments with the Outlook E-mail Security Update

  1. Run Regedit, and go to this key:HKEY_CURRENT_USER\Software\Microsoft\Office\10.0\Outlook\Security (change 10.0 to 9.0 for Outlook 2000 SP3 or to 11.0 for Outlook 2003)
  2. Under that key, add a new string value named Level1Remove.
  3. For the value for Level1Remove, enter a semicolon-delimited list of file extensions. For example, entering this:.mdb;.url

    would unblock Microsoft Access files and Internet shortcuts. Note that the use of a leading dot was not previously required, however, new security patches may require it. If you are using “mdb;url” format and extensions are blocked, add a dot to each extension. Note also that there is not a space between extensions.

FONTE: http://www.slipstick.com/outlook/esecup/getexe.htm

read more »

Cancelar Impressão

—————————————
@echo off
title Cancelar impressao

echo A cancelar a impressao …

echo.
net stop spooler
cd %systemroot%\system32\spool\PRINTERS
del /f /s *.shd
del /f /s *.spl
net start spooler

echo.
pause
exit
—————————————

Mistério

Abram o Google Earth e no campo de procura “Search� insiram as seguintes coordenadas e cliquem no Enter.

45.12402N 123.113008W

Agora aproximem-se do solo aumentando o Zoom e bem perto do solo… Mistério

Permitindo endereços relativos no (IIS 6.0)

Permitindo endereços relativos significa que a sua aplicação poderá usar notações do tipo ..\ nas directivas #Include.
Se estiver actado pode constituir um risco porque um ficheiro Include pode constituir um risco fora da sua root.
No IIS 6.0 os endereços relativos já não estão activos por defeito.
read more »

Notepad++

Notepad ++Notepad++ is a free source code editor (and Notepad replacement), which supports several programming languages, running under the MS Windows environment.

This project, based on the Scintilla edit component (a very powerful editor component), written in C++ with pure win32 api and STL (that ensures the higher execution speed and smaller size of the program), is under the GPL Licence.

This project is mature. However, as you can see it’s a one-man-project, there are still some bugs and missing features. If you have any question or suggestion about this project, please post them on the forums. As well, if you have any feature requests, you can always make the demand, but there’s no guarantee that I’ll implement it.

You’re encouraged to translate Notepad++ (if it is not present in the Download Section) and/or to translate the Notepad++ official site into your native language.

I hope you enjoy Notepad++ as much as I enjoy coding it.

http://notepad-plus.sourceforge.netÂ

Expression Web 1.0

boxShot_Web.jpgExpression Web is a professional design tool to create modern, standards-based sites which deliver superior quality on the Web.

FREE TRIAL

DataGrid e DataList, Arquivos e Imagens

Muitas vezes em nossos sistemas de internet, precisamos exibir uma listagem os arquivos que estão no disco do servidor para o Usuário, seja para uma simples conferência ou até mesmo para edição do mesmos (quando possível).

Há outras ocasiões onde esses arquivos são Imagens, onde devem ser exibidas amigavelmente para o Usuário. Neste caso, não basta exibir o seu nome, ou suas características, mas sim a Imagem propriamente dita.

O .NET Framework nos fornece diversas classes para acesso à arquivos e diretórios. Todas contidas dentro do Namespace System.IO. Neste artigo veremos sobre a classe DirectoryInfo e sobre o método GetFiles().
http://www.linhadecodigo.com.br/artigos.asp?id_ac=362