Tuesday, May 29, 2012

SSRS Reporting Subscription Issue : Unresolved

SSRS Reporting Subscription Issue: Failure sending mail: The server rejected the sender address. The server response was: 530 5.7.0 Must issue a STARTTLS command first.

Problem Description:

Trying to set up SSRS Reporting Subscription using GMAIL account.

SSRS Subscription raises error mentioned above.

Solution available online:

1. Make Gmail to always send email using Secured connection:  http://www.quickonlinetips.com/archives/2008/07/secure-https-gmail/

2. Changing in reporting manager configuration file: http://sqldbastuff.blogspot.in/2010/06/email-configuration-for-ssrs.html

tried both.. No luck yet :(

Raised issue: http://www.sqlservercentral.com/Forums/Topic1308102-162-1.aspx

Any help would be highly appriciated.

Wednesday, May 2, 2012

Copy previous cell data in Excel - Excel Macro

Let's say you have a list of entries in column A, similar to the above example, and within the list you have many blank cells.
Here is a quick and easy way to fill those blanks with the value of the cell above.
Using VBA Macro:

[code]
Sub FillBlanks()
Dim rRange1 As Range, rRange2 As Range
Dim iReply As Integer
If Selection.Cells.Count = 1 Then
MsgBox "You must select your list and include the blank cells", vbInformation
Exit Sub

ElseIf Selection.Columns.Count > 1 Then
MsgBox "You must select only one column", vbInformation
Exit Sub
End If

Set rRange1 = Range(Selection.Cells(1, 1), Cells(65536, Selection.Column).End(xlUp))

On Error Resume Next
Set rRange2 = rRange1.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

If rRange2 Is Nothing Then
MsgBox "No blank cells Found", vbInformation
Exit Sub
End If

rRange2.FormulaR1C1 = "=R[-1]C"

iReply = MsgBox("Cells copied", vbYesNo + vbQuestion)
If iReply = vbYes Then rRange1 = rRange1.Value

End Sub

[/code]

Sunday, April 29, 2012

Working With Excel: Tips and Tricks

Replace Spaces with other characters : Use Substitute function

=SUBSTITUTE(G2," ","")

Monday, April 2, 2012

Split First Name Last Name Company- Split 1 Column to multiple
































NameEmail
user Name1xyz@abc.com
user Name2xyz1@abc.com
User Name 3 (Company Inc)xyz2@abc.com
Mr 123456 678xyz3@abc.com
user Name4 123344 (Company Interactive 123)xyz4@abc.com
Marcelle XYZxyz5@abc.com

Create a temp table and insert the data.

As you can see we may or may not have "braces" with company name.

Use the following code to split the first name, last name and company name.

[code language="sql"]
--drop table temp
Create table temp (
id int identity(1,1)
,Name nvarchar(500)
,Email nvarchar(100)
)

insert into temp values ('user Name1','xyz4@abc.com'),('user Name4 123344 (Company Interactive 123)','xyz4@abc.com')

select * from temp

alter table temp
add
FirstName nvarchar(100),LastName nvarchar(100),Company nvarchar(100)

DECLARE
@Id int
,@Name nvarchar(1000)
,@FirstName nvarchar(100)
,@LastName nvarchar(100)
,@Company nvarchar(100)
,@sDelimiter nVARCHAR(100)

DECLARE vendor_cursor CURSOR FOR
select Id, Name from temp

OPEN vendor_cursor

FETCH NEXT FROM vendor_cursor
INTO @Id, @Name

WHILE @@FETCH_STATUS = 0
BEGIN

select @FirstName = ''
,@LastName = ''
,@Company = ''

SET @sDelimiter = ' '
IF CHARINDEX(@sDelimiter,@Name,0) <> 0
BEGIN
SELECT @FirstName = RTRIM(LTRIM(SUBSTRING(@Name,1,CHARINDEX(@sDelimiter,@Name,0)-1))),
@Name = RTRIM(LTRIM(SUBSTRING(@Name,CHARINDEX(@sDelimiter,@Name,0)+LEN(@sDelimiter),LEN(@Name))))
END

SET @sDelimiter = '('
IF CHARINDEX(@sDelimiter,@Name,0) <> 0
BEGIN
SET @LastName = RTRIM(LTRIM(SUBSTRING(@Name,1,CHARINDEX(@sDelimiter,@Name,0)-1)))
set @Company = REPLACE (RTRIM(LTRIM(SUBSTRING(@Name,CHARINDEX(@sDelimiter,@Name,0)+LEN(@sDelimiter),LEN(@Name)))),')','')
END
ELSE
SET @LastName = substring(@Name,charindex(' ', @Name)+1,len(@Name))

update temp
set
FirstName = @FirstName
,LastName = @LastName
,Company = @Company
where
Id = @Id

FETCH NEXT FROM vendor_cursor
INTO @Id, @Name
END
CLOSE vendor_cursor
DEALLOCATE vendor_cursor

[/code]

Finally, your temp table will have the separated columns.