Issue Description:
Package was running fine
Error:
[Connection manager "Dest File"] Error: SSIS Error Code DTS_E_OLEDB_EXCEL_NOT_SUPPORTED: The Excel Connection Manager is not supported in the 64-bit version of SSIS, as no OLE DB provider is available.
Solution:
You have an Excel connection. The package will need to run in 32 bit mode. To enable 32 bit mode, right click the project in the Solution Explorer and go to properties. Under Debugging, set the property Run64BitRunTime to False.
Showing posts with label excel. Show all posts
Showing posts with label excel. Show all posts
Friday, June 29, 2012
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]
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," ","")
=SUBSTITUTE(G2," ","")
Labels:
excel,
microsoft,
tips,
tricks,
working with excel
Thursday, February 9, 2012
Trim Leading and Trailing quotes before inserting to database - Sql Server
Importing from a excel to SSIS is a tedious task. Some time we have to convert from excel to tab seprated text file and then import.
While converting from excel to tab separated file "quotes" get appended to the text.
Following is a Sql function to remove leading and trailing quotes from text and then insert to db.
[code language="sql"]</pre>
CREATE FUNCTION dbo.TrimQuotes(@str NVARCHAR(MAX))
RETURNS NVARCHAR(MAX)
AS
BEGIN
DECLARE @Start INT, @End Int, @Length INT
SET @Str = REPLACE(RTRIM(LTRIM(@Str)),'""', '"')
SELECT @Start = CHARINDEX('"', @Str), @End = CHARINDEX('"', REVERSE(@Str)),
@Length = LEN(@Str)
IF @Start =1
SET @Start = @Start + 1 -- new string must start from second character
ElSE
SET @Start = 1 --as there is not starting quote. we will not trim it
IF @End != 1
SET @End = 0 -- as there is not ending quote. we will not trim it
SELECT @Str = SUBSTRING(@Str,@Start, @Length - @Start - @End + 1)
RETURN @str
END
GO
SELECT dbo.TrimQuotes ( '"abc"') , dbo.TrimQuotes ( ' abc" ') , dbo.TrimQuotes ( '"a"b"c') , dbo.TrimQuotes ( 'a"b"c')
, dbo.TrimQuotes ( '"abc'), dbo.TrimQuotes ( '"a""bc'), dbo.TrimQuotes ( '"""b""c""')
<pre>
[/code]
While converting from excel to tab separated file "quotes" get appended to the text.
Following is a Sql function to remove leading and trailing quotes from text and then insert to db.
[code language="sql"]</pre>
CREATE FUNCTION dbo.TrimQuotes(@str NVARCHAR(MAX))
RETURNS NVARCHAR(MAX)
AS
BEGIN
DECLARE @Start INT, @End Int, @Length INT
SET @Str = REPLACE(RTRIM(LTRIM(@Str)),'""', '"')
SELECT @Start = CHARINDEX('"', @Str), @End = CHARINDEX('"', REVERSE(@Str)),
@Length = LEN(@Str)
IF @Start =1
SET @Start = @Start + 1 -- new string must start from second character
ElSE
SET @Start = 1 --as there is not starting quote. we will not trim it
IF @End != 1
SET @End = 0 -- as there is not ending quote. we will not trim it
SELECT @Str = SUBSTRING(@Str,@Start, @Length - @Start - @End + 1)
RETURN @str
END
GO
SELECT dbo.TrimQuotes ( '"abc"') , dbo.TrimQuotes ( ' abc" ') , dbo.TrimQuotes ( '"a"b"c') , dbo.TrimQuotes ( 'a"b"c')
, dbo.TrimQuotes ( '"abc'), dbo.TrimQuotes ( '"a""bc'), dbo.TrimQuotes ( '"""b""c""')
<pre>
[/code]
Subscribe to:
Posts (Atom)