Thursday, April 1, 2010
SSIS carriage return in expression builder
Property Expression for the Message of an E-mail Message
The following property expression can be used to set the MessageSource property of a Send Mail task. The expression uses a combination of string literals, user-defined variables, and the concatenation (+) operator. The user-defined variables are named nasdaqrawrows, nyserawrows, and amexrawrows. The string "\n" indicates a carriage return.
"Rows Processed: " + "\n" +" NASDAQ: " + (dt_wstr,9)@[nasdaqrawrows] + "\n" + " NYSE: " + (dt_wstr,9)@[nyserawrows] + "\n" + " Amex: " + (dt_wstr,9)@[amexrawrows]
If nasdaqrawrows is 7058, nyserawrows is 3528, and amexrawrows is 1102, the expression evaluates to the following string.
Rows Processed:
NASDAQ: 7058
NYSE: 3528
AMEX: 1102
Thursday, August 6, 2009
SSIS Retain Connection
When you connect to an Oracle database, you sometimes need to keep the connection to stay in the same session:
It’s simple, goto the properties of your connection and set RetatinSameConnection to TRUE:
Till Next Time
Friday, July 17, 2009
SSIS Dynamic File Name
Till Next Time
Wednesday, December 3, 2008
Wednesday, November 19, 2008
SSIS First and Last Day of the month
Till Next Timedeclare @date datetimeset
@date = getdate()
--get first day of month
select dateadd(m, datediff(m, 0, @date), 0)
--get last day of month
select dateadd(m, datediff(m, 0, dateadd(m, 1, @date)), -1)
Thursday, October 30, 2008
SSIS Reading all the user defined variables
Step 1:
create an ActiveX scripttask with the following script:'GETVARS.SCR
'This function gets all the user defined variables from a SSIS package
'(except ado Objects) and put them in a flatfile
'This flatfile can be
used to transfer the variables to a LOG file
'in the database
'20081030
John Minkjan
Function Main()
Dim oVal
Dim isSystem, varType,
varName, varValue
Dim str, FileName, filesys, filetxt
Const
ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys =
CreateObject("Scripting.FileSystemObject")
FileName = "c:\varfile_"&
DTSGlobalVariables("System::PackageName").Value &".txt"
Set filetxt
= filesys.OpenTextFile(FileName, ForWriting, True)
'Put in a header
filetxt.WriteLine("varName;varType;varValue")
For each oVal in
DTSGlobalVariables
isSystem = oVal.SystemVariable
varType =
oVal.DataType
varName = oVal.QualifiedName
varValue = oVal.Value
if not isSystem then
if varType <> 13 then '(Ado Objects)
if varValue = null or varValue = "" then
varValue = "NULL"
end
if
filetxt.WriteLine(Cstr(varName) &";" & Cstr(varType) &
";" & Cstr(varValue))
end if
end if
Next
filetxt.Close
Main = DTSTaskExecResult_Success
End
Function
Step 2:
Use a data flow to pull the flatfile back into the database for logging:
Till Next Time
Friday, September 5, 2008
SSIS Delete old backup files
Public Sub Main()
Dim strBackupdir As String
Dim strBackupSubDir As
String
Dim strProjectName As String
Dim intDaysBack As Integer
strBackupdir = "..\Backup\"
strProjectName = "project name"
intDaysBack = 7
For Each strSubDirFound As String In Directory.GetDirectories(CStr(strBackupdir))If Mid$(strSubDirFound, Len(strBackupdir) + 1, Len(strProjectName)) = strProjectName Then
For Each FileFound As String In Directory.GetFiles(strSubDirFound, "*.bak")
If File.GetCreationTime(FileFound) < Now().AddDays(-intDaysBack) Then
File.Delete(FileFound)
End If
Next
End
If
Next
Dts.TaskResult = Dts.Results.Success
End Sub
Till Next Time
Friday, August 29, 2008
SSIS Directory exists
SSIS Carriage return in annotation
A carriage return (enter) in SSIS is done with control + enter
Till Next Time
Saturday, August 16, 2008
SSIS Variables in procedures
Add an Execute SQL task to your Sequence Container
At the parameter mapping set direction and Parameter Name. The Parameter Name should a sequence starting at 0. The sequence should correpond with the order of the question marks in in your SQL statement.
Till Next Time
SSIS Back in town.....
Started on a SSIS project today after being an OBIEE junkie for a year. There was a lot of stuff I knew I had done before, but how the F*&% did I do it? Natural conslusion: Let's start up this blog.
Till Next Time