sexta-feira, 30 de agosto de 2013

Customize email alias for from field in SSRS

When you want to change the from information sent by SSRS in your subscriptions just set up an account with an alias before the email account in the tag of the RSReportServer.config file. Follow me:

  1. Open the file in \Microsoft SQL Server\MSRS.MSSQLServer\Reporting Services\ReportServer\rsreportserver.config
  2. Locate the tag inside the tag, subsections (or just search for using a search tool)
  3. Change the original email configuration from email@domain.com to "Alias you want" email@domain.com
  4. Save your changes and submit the report. Depending on your email toos you will see the alias in the from field with or without the email following it.
I hope to have contributed.
Cheers.


sexta-feira, 9 de agosto de 2013

Usando o GO para executar um comando vezes


CREATE TABLE #tmp (id int primary key identity(1,1), counter int default 0)
GO

-- Inserindo dados na tabela
INSERT INTO #tmp DEFAULT VALUES
GO 10

--Vai executar o Insert 10 vezes, sem necessidade de loop

Preenchendo campo com valores sequenciais

Dica muito útil para preencher um campo inteiro com valores sequenciais, o que não é muito raro de precisar para quem vive dando consultoria para clientes.

Segue a dica original: http://www.sqlserverdicas.com/2011/11/update-com-incremento.html

E esta é a minha utilização, baseada na dica original.


DECLARE @counter int
SET @counter = (select max(codcliente)+1 from clientes);

update clientes 
set @counter = CodCliente = @counter + 1 
where codcliente = 0

Assim eu pude completar os codigos que estavam zerados com valores sequenciais, começando do último mais um, e seguindo em frente.