Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42316

procedure to filter data on the basis of specific store

$
0
0
HI Friends, i am getting the following error .
{CALL sp_MSupd_PS_Stores200 (NULL,NULL,'Re-open on 13-07-2012',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL ,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL ,'ADAMOAST165 ',0x040000000000)}
Transaction sequence number and command ID of last execution batch are 0x0003F2E900006BF4000100000000 and 1.

i tried the following way .i simple want whenever @pkc1='ADAMOAST165' it needs to go at the endfunction point .but it is not working .let me know please .

if @pkc1='ADAMOAST165' RETURN
Code:




alter procedure "sp_MSupd_PS_Stores200"
 @c1 char(15),@c2 varchar(50),@c3 varchar(50),@c4 char(15),@c5 char(15),@c6 char(15),@c7 char(15),@c8 char(15),@c9 char(15),@c10 varchar(100),@c11 varchar(100),@c12 varchar(20),@c13 varchar(20),@c14 varchar(20),@c15 varchar(20),@c16 varchar(20),@c17 char(15),@c18 int,@c19 datetime,@c20 int,@c21 int,@c22 datetime,@c23 tinyint,@c24 datetime,@c25 char(15),@c26 char(15),@c27 char(15),@c28 char(15),@c29 char(15),@c30 char(15),@c31 char(20),@c32 char(15),@c33 char(15),@c34 char(15),@c35 char(15),@c36 char(35),@c37 char(20),@c38 char(15),@c39 char(15),@c40 char(15),@c41 char(15),@c42 char(35),@pkc1 char(15)
,@bitmap binary(6)
as
if substring(@bitmap,1,1) & 1 = 1

begin
if @pkc1='ADAMOAST165' RETURN
ELSE
begin  script added for filter
update "PS_Stores" set
"StoreID" = case substring(@bitmap,1,1) & 1 when 1 then @c1 else "StoreID" end
,"L1Description" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "L1Description" end
,"L2Description" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "L2Description" end
,"StoreCategory" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "StoreCategory" end
,"StoreType" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "StoreType" end
,"StoreGroup" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "StoreGroup" end
,"LinkedtoWarehouse" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "LinkedtoWarehouse" end
,"LocationCode" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "LocationCode" end
,"CalenderID" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "CalenderID" end
,"Address1" = case substring(@bitmap,2,1) & 2 when 2 then @c10 else "Address1" end
,"Address2" = case substring(@bitmap,2,1) & 4 when 4 then @c11 else "Address2" end
,"Telephone1" = case substring(@bitmap,2,1) & 8 when 8 then @c12 else "Telephone1" end
,"Telephone2" = case substring(@bitmap,2,1) & 16 when 16 then @c13 else "Telephone2" end
,"Telephone3" = case substring(@bitmap,2,1) & 32 when 32 then @c14 else "Telephone3" end
,"Fax1" = case substring(@bitmap,2,1) & 64 when 64 then @c15 else "Fax1" end
,"Fax2" = case substring(@bitmap,2,1) & 128 when 128 then @c16 else "Fax2" end
,"ManagerID" = case substring(@bitmap,3,1) & 1 when 1 then @c17 else "ManagerID" end
,"EntryUser" = case substring(@bitmap,3,1) & 2 when 2 then @c18 else "EntryUser" end
,"EntryTime" = case substring(@bitmap,3,1) & 4 when 4 then @c19 else "EntryTime" end
,"ModifingLocation" = case substring(@bitmap,3,1) & 8 when 8 then @c20 else "ModifingLocation" end
,"ModifiedBy" = case substring(@bitmap,3,1) & 16 when 16 then @c21 else "ModifiedBy" end
,"ModifyTime" = case substring(@bitmap,3,1) & 32 when 32 then @c22 else "ModifyTime" end
,"IsCopied" = case substring(@bitmap,3,1) & 64 when 64 then @c23 else "IsCopied" end
,"CopyDateTime" = case substring(@bitmap,3,1) & 128 when 128 then @c24 else "CopyDateTime" end
,"BranchID" = case substring(@bitmap,4,1) & 1 when 1 then @c25 else "BranchID" end
,"ICDebitTrxType" = case substring(@bitmap,4,1) & 2 when 2 then @c26 else "ICDebitTrxType" end
,"ICCreditTrxType" = case substring(@bitmap,4,1) & 4 when 4 then @c27 else "ICCreditTrxType" end
,"LinkToReturnWarehouse" = case substring(@bitmap,4,1) & 8 when 8 then @c28 else "LinkToReturnWarehouse" end
,"DefaultCustomer" = case substring(@bitmap,4,1) & 16 when 16 then @c29 else "DefaultCustomer" end
,"BrandID" = case substring(@bitmap,4,1) & 32 when 32 then @c30 else "BrandID" end
,"WriteOffCreditCostCenter" = case substring(@bitmap,4,1) & 64 when 64 then @c31 else "WriteOffCreditCostCenter" end
,"WriteOffCreditJournalID" = case substring(@bitmap,4,1) & 128 when 128 then @c32 else "WriteOffCreditJournalID" end
,"WriteOffCreditDepartmentID" = case substring(@bitmap,5,1) & 1 when 1 then @c33 else "WriteOffCreditDepartmentID" end
,"WriteOffCreditProjectId" = case substring(@bitmap,5,1) & 2 when 2 then @c34 else "WriteOffCreditProjectId" end
,"WriteOffCreditBudgetCode" = case substring(@bitmap,5,1) & 4 when 4 then @c35 else "WriteOffCreditBudgetCode" end
,"WriteOffCreditAccount" = case substring(@bitmap,5,1) & 8 when 8 then @c36 else "WriteOffCreditAccount" end
,"WriteOffDebitCostCenter" = case substring(@bitmap,5,1) & 16 when 16 then @c37 else "WriteOffDebitCostCenter" end
,"WriteOffDebitJournalID" = case substring(@bitmap,5,1) & 32 when 32 then @c38 else "WriteOffDebitJournalID" end
,"WriteOffDebitDepartmentID" = case substring(@bitmap,5,1) & 64 when 64 then @c39 else "WriteOffDebitDepartmentID" end
,"WriteOffDebitProjectId" = case substring(@bitmap,5,1) & 128 when 128 then @c40 else "WriteOffDebitProjectId" end
,"WriteOffDebitBudgetCode" = case substring(@bitmap,6,1) & 1 when 1 then @c41 else "WriteOffDebitBudgetCode" end
,"WriteOffDebitAccount" = case substring(@bitmap,6,1) & 2 when 2 then @c42 else "WriteOffDebitAccount" end
where "StoreID" = @pkc1
if @@rowcount = 0
        if @@microsoftversion>0x07320000
                exec sp_MSreplraiserror 20598
end
end
else
begin
if left(@PKc1,3)NOT IN (SELECT BRANDID FROM HK_BRANDLIST) RETURN
update "PS_Stores" set
"L1Description" = case substring(@bitmap,1,1) & 2 when 2 then @c2 else "L1Description" end
,"L2Description" = case substring(@bitmap,1,1) & 4 when 4 then @c3 else "L2Description" end
,"StoreCategory" = case substring(@bitmap,1,1) & 8 when 8 then @c4 else "StoreCategory" end
,"StoreType" = case substring(@bitmap,1,1) & 16 when 16 then @c5 else "StoreType" end
,"StoreGroup" = case substring(@bitmap,1,1) & 32 when 32 then @c6 else "StoreGroup" end
,"LinkedtoWarehouse" = case substring(@bitmap,1,1) & 64 when 64 then @c7 else "LinkedtoWarehouse" end
,"LocationCode" = case substring(@bitmap,1,1) & 128 when 128 then @c8 else "LocationCode" end
,"CalenderID" = case substring(@bitmap,2,1) & 1 when 1 then @c9 else "CalenderID" end
,"Address1" = case substring(@bitmap,2,1) & 2 when 2 then @c10 else "Address1" end
,"Address2" = case substring(@bitmap,2,1) & 4 when 4 then @c11 else "Address2" end
,"Telephone1" = case substring(@bitmap,2,1) & 8 when 8 then @c12 else "Telephone1" end
,"Telephone2" = case substring(@bitmap,2,1) & 16 when 16 then @c13 else "Telephone2" end
,"Telephone3" = case substring(@bitmap,2,1) & 32 when 32 then @c14 else "Telephone3" end
,"Fax1" = case substring(@bitmap,2,1) & 64 when 64 then @c15 else "Fax1" end
,"Fax2" = case substring(@bitmap,2,1) & 128 when 128 then @c16 else "Fax2" end
,"ManagerID" = case substring(@bitmap,3,1) & 1 when 1 then @c17 else "ManagerID" end
,"EntryUser" = case substring(@bitmap,3,1) & 2 when 2 then @c18 else "EntryUser" end
,"EntryTime" = case substring(@bitmap,3,1) & 4 when 4 then @c19 else "EntryTime" end
,"ModifingLocation" = case substring(@bitmap,3,1) & 8 when 8 then @c20 else "ModifingLocation" end
,"ModifiedBy" = case substring(@bitmap,3,1) & 16 when 16 then @c21 else "ModifiedBy" end
,"ModifyTime" = case substring(@bitmap,3,1) & 32 when 32 then @c22 else "ModifyTime" end
,"IsCopied" = case substring(@bitmap,3,1) & 64 when 64 then @c23 else "IsCopied" end
,"CopyDateTime" = case substring(@bitmap,3,1) & 128 when 128 then @c24 else "CopyDateTime" end
,"BranchID" = case substring(@bitmap,4,1) & 1 when 1 then @c25 else "BranchID" end
,"ICDebitTrxType" = case substring(@bitmap,4,1) & 2 when 2 then @c26 else "ICDebitTrxType" end
,"ICCreditTrxType" = case substring(@bitmap,4,1) & 4 when 4 then @c27 else "ICCreditTrxType" end
,"LinkToReturnWarehouse" = case substring(@bitmap,4,1) & 8 when 8 then @c28 else "LinkToReturnWarehouse" end
,"DefaultCustomer" = case substring(@bitmap,4,1) & 16 when 16 then @c29 else "DefaultCustomer" end
,"BrandID" = case substring(@bitmap,4,1) & 32 when 32 then @c30 else "BrandID" end
,"WriteOffCreditCostCenter" = case substring(@bitmap,4,1) & 64 when 64 then @c31 else "WriteOffCreditCostCenter" end
,"WriteOffCreditJournalID" = case substring(@bitmap,4,1) & 128 when 128 then @c32 else "WriteOffCreditJournalID" end
,"WriteOffCreditDepartmentID" = case substring(@bitmap,5,1) & 1 when 1 then @c33 else "WriteOffCreditDepartmentID" end
,"WriteOffCreditProjectId" = case substring(@bitmap,5,1) & 2 when 2 then @c34 else "WriteOffCreditProjectId" end
,"WriteOffCreditBudgetCode" = case substring(@bitmap,5,1) & 4 when 4 then @c35 else "WriteOffCreditBudgetCode" end
,"WriteOffCreditAccount" = case substring(@bitmap,5,1) & 8 when 8 then @c36 else "WriteOffCreditAccount" end
,"WriteOffDebitCostCenter" = case substring(@bitmap,5,1) & 16 when 16 then @c37 else "WriteOffDebitCostCenter" end
,"WriteOffDebitJournalID" = case substring(@bitmap,5,1) & 32 when 32 then @c38 else "WriteOffDebitJournalID" end
,"WriteOffDebitDepartmentID" = case substring(@bitmap,5,1) & 64 when 64 then @c39 else "WriteOffDebitDepartmentID" end
,"WriteOffDebitProjectId" = case substring(@bitmap,5,1) & 128 when 128 then @c40 else "WriteOffDebitProjectId" end
,"WriteOffDebitBudgetCode" = case substring(@bitmap,6,1) & 1 when 1 then @c41 else "WriteOffDebitBudgetCode" end
,"WriteOffDebitAccount" = case substring(@bitmap,6,1) & 2 when 2 then @c42 else "WriteOffDebitAccount" end
where "StoreID" = @pkc1
if @@rowcount = 0
        if @@microsoftversion>0x07320000
                exec sp_MSreplraiserror 20598
end



GO


Viewing all articles
Browse latest Browse all 42316

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>