Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Get-EmployeeData
- {
- $employeeID = Read-Host "Please Enter Employee ID"
- $firstN = "a.F_N as EI_FN,b.F_N as OI_FN"
- $lastN = "a.L_N as EI_LN,b.L_N as OI_LN"
- $query = "SELECT OFFICE_ID,a.emp_id as EMP_ID,$firstN,$lastN,CITY,STATE,ZIP_CODE "
- $query += "FROM test_org..org_info as a,test_org..emp_info as b "
- $query += "WHERE a.emp_id=$employeeID AND a.emp_id=b.emp_id"
- $results = Invoke-SQLCmd -query $query -ServerInstance NSRESQL1
- $empInfoFN = $results.EI_FN
- $offInfoFN = $results.OI_FN
- if($empInfoFN -ne $offInfoFN)
- {
- $results | select-object EMP_ID,EI_FN,OI_FN,EI_LN,OI_LN | format-table
- write-host "Data values do not match"
- }
- elseif($empInfoFN -eq $offInfoFN)
- {
- $results | select-object EMP_ID,EI_FN,OI_FN,EI_LN,OI_LN | format-table
- write-host "values match"
- }
- else
- {
- write-host "an error has occurred"
- }
- }
- Get-EmployeeData
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement