Click here to Skip to main content
15,904,822 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: binary file encryption Pin
Ben Fair22-Jan-09 5:59
Ben Fair22-Jan-09 5:59 
QuestionTimed GTalk Status Updater Pin
itsravie21-Jan-09 0:25
itsravie21-Jan-09 0:25 
AnswerRe: Timed GTalk Status Updater Pin
Dave Kreskowiak21-Jan-09 2:02
mveDave Kreskowiak21-Jan-09 2:02 
AnswerRe: Timed GTalk Status Updater Pin
Eddy Vluggen21-Jan-09 2:34
professionalEddy Vluggen21-Jan-09 2:34 
GeneralRe: Timed GTalk Status Updater Pin
Mohammad Dayyan21-Jan-09 8:52
Mohammad Dayyan21-Jan-09 8:52 
AnswerRe: Timed GTalk Status Updater Pin
itsravie25-Jan-09 12:07
itsravie25-Jan-09 12:07 
QuestionDeserialisation Problem with Generic Methods and Delegates Pin
mi220-Jan-09 22:43
mi220-Jan-09 22:43 
QuestionBCP process does not throw proper exceptions incase of any failures Pin
indian14320-Jan-09 19:52
indian14320-Jan-09 19:52 
Hi All,

I have a BCP utility runs by a job CTS in Windows schedular. It is working properly, but the problem is I want the BCP to throw a proper exception and status message to CTS when exception occurs. So that the CTS can send emails with proper message to a particular team.

Can any body please help me in completing this task. I am writing some BCP code sample below. Any kind of help can be very much thankfull.

Please let me know if you need any more information to help.

Thanks a Lot,
Aleem Mohammad.


isql -Q"IF EXISTS(SELECT 1 from %db_name_src%.dbo.DB_STATUS WHERE UPPER(Status) <> 'AVAILABLE' OR CONVERT(char(10),Data_as_of,101) <> CONVERT(char(10),getdate(),101)) BEGIN RAISERROR('An error has occured',16, 1) END" -b -c -S%srv_name_src% -U%login_src% -P%password_src% 

if %errorlevel% EQU 1 GOTO :data_unavailable


rem ********* starting the bulk copy for export**********************************************************************************************************************************

rem ********* Accounts table data**********************************************************************************************************************************
bcp "SELECT account_id,Accountant_Cd from %db_name_src%.dbo.ACCOUNT WHERE Control_ID NOT IN ('0412','0361','0410','0364','0441','0442','0394','0395','0396','0444','0373','0416','0392') AND Account_Status_Cd ='0'" queryout %file_path%ACCOUNT.dat -c -S%srv_name_src% -U%login_src% -P%password_src% >%file_path%\PMMIR_Fetch_ODR_data_Tax_Detail_log.log -e %file_path%\Error.TXT  || goto error_handler

rem ********* Asset table data*************************************************************************************************************************************
bcp "SELECT Property_Num,CUSIP_ID,Ticker_Symbol_ID,Asset_Short_Nm,Current_Prc FROM %db_name_src%.dbo.ASSET WHERE Unique_Asset_Fl ='0'" queryout %file_path%ASSET.dat -c -S%srv_name_src% -U%login_src% -P%password_src% >>%file_path%\PMMIR_Fetch_ODR_data_Tax_Detail_log.log -e %file_path%\Error.TXT || goto error_handler

rem ********* Accountbalance table data**********************************************************************************************************************************
bcp "SELECT ACCOUNT_BALANCE.Account_ID,Fiscal_Year_Fed_ST_Gain_Amt,Fiscal_Year_Fed_ST_Loss_Amt,Fiscal_Year_Fed_LT_Gain_Amt,Fiscal_Year_Fed_LT_Loss_Amt FROM %db_name_src%.dbo.ACCOUNT_BALANCE as ACCOUNT_BALANCE , %db_name_src%.dbo.ACCOUNT as ACCOUNT WHERE ACCOUNT_BALANCE.Account_ID = ACCOUNT.Account_ID AND Control_ID NOT IN ('0412','0361','0410','0364','0441','0442','0394','0395','0396','0444','0373','0416','0392') AND Account_Status_Cd ='0'" queryout %file_path%ACCOUNT_BALANCE.dat -c -S%srv_name_src% -U%login_src% -P%password_src% >>%file_path%\PMMIR_Fetch_ODR_data_Tax_Detail_log.log -e %file_path%\Error.TXT || goto error_handler

rem ********* ACCOUNTANT table data**********************************************************************************************************************************
bcp "SELECT distinct ACCOUNTANT.Accountant_Cd,Accountant_nm FROM  %db_name_src%.dbo.ACCOUNTANT as ACCOUNTANT, %db_name_src%.dbo.ACCOUNT as ACCOUNT WHERE ACCOUNTANT.Accountant_Cd = ACCOUNT.Accountant_Cd AND Control_ID NOT IN ('0412','0361','0410','0364','0441','0442','0394','0395','0396','0444','0373','0416','0392') AND Account_Status_Cd ='0'" queryout %file_path%ACCOUNTANT.dat -c -S%srv_name_src% -U%login_src% -P%password_src% >>%file_path%\PMMIR_Fetch_ODR_data_Tax_Detail_log.log -e %file_path%\Error.TXT || goto error_handler

rem ********* TaxLot Details table data**********************************************************************************************************************************
bcp "SELECT ACCOUNT.Account_ID,Property_Num,Portfolio_Num,Shares_Par_Value_Qty,Federal_Tax_Acquisition_Dt,Federal_Tax_cost_Amt, 0 as Unique_Asset_fl FROM %db_name_src%.dbo.TAX_DETAIL as TAX_DETAIL,%db_name_src%.dbo.ACCOUNT as ACCOUNT WHERE Unique_Asset_fl = 0 AND TAX_DETAIL.Account_ID = ACCOUNT.Account_ID AND Control_ID NOT IN ('0412','0361','0410','0364','0441','0442','0394','0395','0396','0444','0373','0416','0392') AND Account_Status_Cd ='0'" queryout %file_path%TAX_DETAIL.dat -c -S%srv_name_src% -U%login_src% -P%password_src% >>%file_path%\PMMIR_Fetch_ODR_data_Tax_Detail_log.log -e %file_path%\Error.TXT || goto error_handler

rem ********* DB_STATUS table data**********************************************************************************************************************************
bcp "SELECT Last_Update,Status_Code,Application,Status,Data_As_Of FROM %db_name_src%.dbo.DB_STATUS" queryout %file_path%DB_STATUS.dat -c -S%srv_name_src% -U%login_src% -P%password_src% >>%file_path%\PMMIR_Fetch_ODR_data_Tax_Detail_log.log -e %file_path%\Error.TXT || goto error_handler

rem ********* starting the bulk copy for Import**********************************************************************************************************************************

rem ********* Update DB_STATUS table data**********************************************************************************************************************************

isql -U%login_dest% -d%db_name_dest% -Q"UPDATE DB_STATUS SET Application = 'BB', Status = 'UnAvailable', Status_Code = 0, Last_Update = GETDATE()" -S%srv_name_dest% -U%login_dest%  -P%password_dest% >>%file_path%\PMMIR_Fetch_ODR_data_Tax_Detail_log.log -e %file_path%\Error.TXT || goto error_handler


rem ********* Accounts table data**********************************************************************************************************************************

isql -U%login_dest% -d%db_name_dest% -Q"truncate table ACCOUNT" -S%srv_name_dest% -P%password_dest%

bcp %db_name_dest%.dbo.ACCOUNT in %file_path%\ACCOUNT.dat -c -S%srv_name_dest% -U%login_dest%  -P%password_dest% -b10000 >>%file_path%\PMMIR_Fetch_ODR_data_Tax_Detail_log.log -e %file_path%\Error.TXT || goto error_handler


Thanks & Regards,

Md. Abdul Aleem
NIIT technologies

AnswerSorry the message became too big as I am unable to edit it, again I am writing the question here [modified] Pin
indian14320-Jan-09 19:57
indian14320-Jan-09 19:57 
GeneralRe: Sorry the message became too big as I am unable to edit it, again I am writing the question here Pin
Dave Kreskowiak21-Jan-09 2:00
mveDave Kreskowiak21-Jan-09 2:00 
AnswerRe: BCP process does not throw proper exceptions incase of any failures Pin
Wendelius21-Jan-09 5:19
mentorWendelius21-Jan-09 5:19 
Question.Net Pin
Smtnri20-Jan-09 8:50
Smtnri20-Jan-09 8:50 
AnswerRe: .Net Pin
Not Active20-Jan-09 9:01
mentorNot Active20-Jan-09 9:01 
AnswerWow. Pin
leckey20-Jan-09 9:47
leckey20-Jan-09 9:47 
AnswerRe: .Net Pin
Pete O'Hanlon20-Jan-09 10:38
mvePete O'Hanlon20-Jan-09 10:38 
JokeRe: .Net Pin
0x3c020-Jan-09 10:52
0x3c020-Jan-09 10:52 
GeneralRe: .Net Pin
Mohammad Dayyan20-Jan-09 20:05
Mohammad Dayyan20-Jan-09 20:05 
AnswerRe: .Net Pin
Mohammad Dayyan20-Jan-09 20:06
Mohammad Dayyan20-Jan-09 20:06 
AnswerRe: .Net Pin
Ashutosh Phoujdar22-Jan-09 0:42
Ashutosh Phoujdar22-Jan-09 0:42 
Questionvb.net using json Pin
yanm778819-Jan-09 18:39
yanm778819-Jan-09 18:39 
AnswerRe: vb.net using json Pin
Eddy Vluggen20-Jan-09 3:17
professionalEddy Vluggen20-Jan-09 3:17 
QuestionReferencing DLL's Pin
OldSchoolToC#19-Jan-09 14:23
OldSchoolToC#19-Jan-09 14:23 
AnswerRe: Referencing DLL's Pin
Eddy Vluggen20-Jan-09 3:19
professionalEddy Vluggen20-Jan-09 3:19 
GeneralRe: Referencing DLL's Pin
OldSchoolToC#20-Jan-09 7:54
OldSchoolToC#20-Jan-09 7:54 
AnswerRe: Referencing DLL's Pin
Wendelius20-Jan-09 9:13
mentorWendelius20-Jan-09 9:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.