Friday, September 7, 2018

Thank you note After Phone Interview







Hello XXX and XXX,


I greatly appreciate to you both for spent time with me on Wednesday 09/05/2018  for a phone interview. I enjoyed speaking with you both about the role, nature of daily task and the team. I am very interested in this position of XXXX and the opportunity to join the team.  

As we discussed, you need someone with strong SQL, Excel skills and Finance background, and I have extensive experience with SQL Server, Excel, Job automation and Finance Degree. In addition, my current and past job as Data engineer helps me to sharpen my skills in SQL, Excel and adhoc daily task on fast paced, which is needed for your [XXXX job position name] position.

After learning more specific details about the position and it’s role within your team, I have every confidence my educational background, experience and expertise are a great match for the job. I’m filled with a sense of enthusiasm, energy and excitement about the prospect of joining your team.

If there are additional questions you’d like to ask, or information you’d like me to provide, please don’t hesitate to contact me.

Thank you again for taking the time to speak with me via a phone interview. I look forward to hearing from your team soon about your hiring decision.


Best regards
XXX

Tuesday, September 4, 2018

Thanks to Hiring Manager After Interview


Hello


Dear [Interviewer’s name],

Thank you XXX  and XXX for taking time from your busy schedule to meet with me last week about the XXX role. It was great to meet with you all and learn more about the position.

I am very interested in this position and the opportunity to join the team, and I am particularly interested in financial area with the blend of SQL, Excel and other technologies that you shared about the position. As we discussed, you need someone with strong 
SQLExcel skills and Finance background, and I have extensive experience with SQL ServerExcelJob automation and Finance Degree. In addition, my current and past job as Data engineer helps me to sharpen my skills in SQL and excel which is needed for your [XXXX job position name] position.

After our conversation, I’m confident that my background and experience will enable me to fill the job requirements effectively and support the vision of your Team. Please feel free to contact me if I can provide you with any further information.

I appreciate the time you took to interview me. I am very interested in working for you and look forward to hearing from you regarding this position.



Thanks again,

Friday, August 31, 2018

Sample email to recruiter after Interview







Hello XXX Recruiter Name,

Thank you very much for the opportunity to interview for the position of [XXXX job position name]  yesterday. I enjoyed speaking with you, XXXX and XXXX and the opportunity to learn more about this position. I am very interested in this position and the opportunity to join the team.

This job feels like a very good match between my skills and experience and the requirements of this job. As we discussed, you need someone with strong SQL, Excel skills and Finance background, and I have extensive experience with SQL Server, Excel, Job automation and Finance Degree. In addition, my current and past job as Data engineer  help me to sharpen my skills in SQL and excel which is needed for your [XXXX job position name] position.

Again, Thank you for considering me for this opportunity. Please let me know if you need any information. I look forward to hearing from you next week and hope to join your company soon.

Best Regards,

Tuesday, April 24, 2018

How to fix Type 2 table data incase delete and reload



USE DATABASE_NAME
GO

SELECT
Table_Key,Source_Key,Effective_From_Date,Version_Nbr,Effective_Thru_Date
,Rank_Nbr = RANK() OVER(PARTITION BY Source_Key ORDER BY Effective_From_Date DESC)
 INTO #Table_Name_FIX
 FROM DATABASE_NAME.dbo.Table_Name
 WHERE Effective_Thru_Date = '9999-12-31';


 SELECT
  cd.Table_Key
 ,cd.Source_Key
 ,cd.Effective_From_Date
 ,cd.Version_Nbr
 ,Effective_Thru_Date = DATEADD(D,-1,t.Effective_From_Date)
 ,Latest_Ind = 'N'
 INTO #Table_Name_FIX_Prior_Row
 FROM #Table_Name_FIX cd
 JOIN #Table_Name_FIX t ON cd.Card_Key = t.Card_Key
 WHERE cd.Rank_Nbr = 2 AND t.Rank_Nbr = 1;


 SELECT
  cd.Table_Key
 ,cd.Source_Key
 ,cd.Effective_From_Date
 ,Version_Nbr = t.Version_Nbr + 1
 INTO #Table_Name_FIX_Current_Row
 FROM #Table_Name_FIX cd
 JOIN #Table_Name_FIX t ON cd.Card_Key = t.Card_Key
 WHERE cd.Rank_Nbr = 1 AND t.Rank_Nbr = 2;


UPDATE cd
  SET  cd.Effective_Thru_Date = s.Effective_Thru_Date
      ,cd.Latest_Ind = s.Latest_Ind
  ,cd.Last_Modify_Date = GETDATE()
  FROM DATABASE_NAME.dbo.Table_Name cd
  JOIN #Table_Name_FIX_Prior_Row s ON cd.Table_Key = s.Table_Key;

UPDATE cd
  SET  cd.Version_Nbr = s.Version_Nbr
      ,cd.Last_Modify_Date = GETDATE()
  FROM DATABASE_NAME.dbo.Table_Name cd
  JOIN #Table_Name_FIX_Current_Row s ON cd.Table_Key = s.Table_Key;

Monday, April 23, 2018

PowerShell BCP file import

PowerShell BCP file import

$inFilePath = "D:\Profile_Cusotmer.csv"
$csvColumnNames = (Get-Content $inFilePath | Select-Object -First 1).Split(",")
$Columns = (Get-Content $inFilePath | Select-Object -First 1).Split(",").Count
$Column_Names = $csvColumnNames[0].Substring(1)+' NVARCHAR(MAX),'
For ($i=1; $i -lt $Columns; $i++) {
    $Column_Names = $Column_Names+$csvColumnNames[$i]+' NVARCHAR(MAX),'
    }
$Column_Names = '( '+$Column_Names+' )'

$connection = New-Object System.Data.SqlClient.SqlConnection("Data Source=SQLSERVER ;Integrated Security=SSPI;Initial Catalog=DB_NAME;")
$query = "IF EXISTS(Select name From sys.tables Where name='TABLE_NAME') DROP TABLE DBO.TABLE_NAME; CREATE TABLE DBO.TABLE_NAME $Column_Names";
$connection.Open();
$command = new-object System.Data.SqlClient.SqlCommand($query, $connection);
$command.ExecuteNonQuery();
$connection.Close();
$BCPCommand = "BCP DB_NAME.dbo.TABLE_NAME IN $inFilePath -c -T -S  SQLSERVER -t',' -F 2"
write-host "$BCPCommand"
$Bcp=Invoke-Expression $BCPCommand

Check Empty File

Check Empty File

@echo off
cd D:\ABC\
set file="empty.txt"

set ZeroByteSize=0

FOR /F "usebackq" %%A IN ('%file%') DO set size=%%~zA

if %size% GTR %ZeroByteSize% (
   exit 0

)ELSE (
 
if ERRORLEVEL 1 goto :ErrorTrap

)

goto :EOF


:ErrorTrap

echo.
echo FAILED - SCRIPT ABORTED >>testlog.txt
exit 1

goto :EOF

BatchScript _send email using Control M Job

BatchScript _send email  using Control M Job

@ECHO OFF

SET SQL=SELECT Transaction_Date_Count = CASE WHEN DATEDIFF (DAY, GETDATE(), MAX(Transaction_Date)) ^> 300 THEN 'Transaction Date Exist' ELSE 'Max Transaction Date Count is Less Than 30 Days,' END FROM DB_NAME.dbo.Vw_table_name
FOR /F "eol=;  tokens=1 delims=," %%A  IN ('CALL SQLCMD -S SQLSERVER -E -Q"SET NOCOUNT ON;%SQL%" -h -1') DO (SET Transaction_Date_Count=%%A)

IF ERRORLEVEL 1 (goto :ErrorTrap)

ECHO RecordResult %Transaction_Date_Count%
IF "[%Transaction_Date_Count%]" == "[Max Transaction Date Count is Less Than 30 Days]"

goto :SendEmail
:SendEmail
ECHO Hello  Team,
ECHO.
ECHO RecordResult %Transaction_Date_Count%
ECHO , Please Re-Generate this Transaction Date calendar and send to us.
ECHO.
ECHO JOBNAME : %JOBNAME%
ECHO.
ECHO Thanks,
ECHO myTeam
ECHO myteam@.com

PAUSE
:ErrorTrap

 echo.
 echo FAILED - SCRIPT ABORTED - %STEP%
 DATE /T 
 TIME /T
 exit 1
goto :EOF

CONTROL M
@ECHO OFF
:COUNT
FOR /F "eol=;  tokens=1 delims=," %%A  IN ('CALL %SQLCMD% -S %DATAWAREHOUSE% -E -Q"SET NOCOUNT ON;%SQL%" -h -1') DO (SET LETTER=%%A) 
IF ERRORLEVEL 1 (SET STEP=COUNT) & (GOTO :ERR)
ECHO Letter Name is  :  %LETTER%
ECHO. >> %MSG_FILE%
ECHO  Max Transaction Date is  %LETTER% 
ECHO. >> %MSG_FILE%
ECHO JOBNAME : %JOBNAME% >> %MSG_FILE%
GOTO :EOF