0% found this document useful (0 votes)
32 views2 pages

Query

important queries

Uploaded by

santoshmanoj05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views2 pages

Query

important queries

Uploaded by

santoshmanoj05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

SELECT * FROM dbo.

BL_Customer WHERE FirstName IS NULL OR FirstName=''


SELECT * FROM dbo.BL_Customer WHERE FatherHusbandName IS NULL OR FatherHusbandNa
me=''
SELECT * FROM dbo.BL_Customer WHERE GenderId NOT IN(1,2,3)--Member with invalid
gender id
SELECT * FROM dbo.BL_Customer WHERE DOB >= dbo.PCBS_udfGetDate() OR DOB<'01-01-1
900'--Member with invalid DOB
SELECT * FROM dbo.BL_Customer WHERE Age >= 100 OR Age<=0--Member with invalid Ag
e
SELECT * FROM BL_Customer WHERE CateogryID NOT IN(SELECT CateogryID FROM dbo.Cat
agory)--Member with invalid category id
SELECT * FROM BL_Customer WHERE CustNatureID NOT IN(SELECT CustNatureID FROM dbo
.NatureOfCustomer)--Member with invalid nature of customer id
SELECT * FROM BL_Customer WHERE OccupationID NOT IN(SELECT OccupationID FROM dbo
.Occupation)--Member with invalid occupation id
SELECT * FROM BL_Customer WHERE CommunityID NOT IN(SELECT CommunityID FROM dbo.C
ommunity)--Member with invalid community id
SELECT * FROM BL_Customer WHERE QualificationID NOT IN(SELECT QualificationID FR
OM dbo.Qualification)--Member with invalid qualification id
SELECT * FROM BL_Customer WHERE MaritalStatusID NOT IN(SELECT MaritalStatusID FR
OM dbo.MaritalStatus)--Member with invalid marital status id
SELECT * FROM BL_Customer WHERE ReligionID NOT IN(SELECT ReligionID FROM dbo.Rel
igion)--Member with invalid religion id
SELECT * FROM BL_Customer WHERE NationalityID NOT IN(SELECT NationalityID FROM d
bo.Nationality)--Member with invalid nationality id
SELECT * FROM BL_Customer WHERE IdProofID NOT IN(SELECT IdProofID FROM dbo.IDPro
of)--Member with invalid idproof id
SELECT * FROM BL_Customer WHERE ResidentialProofId NOT IN(SELECT ResidentialProo
fId FROM dbo.ResidentialProof)--Member with invalid residential proof id
SELECT * FROM BL_Customer WHERE AnnualIncomeID NOT IN(SELECT AnnualIncomeID FROM
dbo.AnnualIncome)--Member with invalid annula income id
SELECT * FROM dbo.BL_Customer WHERE AddressLine1 IS NULL OR AddressLine1=''--Mem
ber with invalid Address id
SELECT * FROM BL_Customer WHERE TahsilID NOT IN(SELECT TahsilID FROM dbo.Tahsil)
OR TahsilID IS NULL--Member with invalid tahsil id
SELECT * FROM BL_Customer WHERE PostOfficeID NOT IN(SELECT PostOfficeID FROM dbo
.POSTOFFICE) OR PostOfficeID IS NULL--Member with invalid Postoffice id
SELECT * FROM BL_Customer WHERE VillageID NOT IN(SELECT VillageID FROM dbo.Villa
ge) OR VillageID IS NULL--Member with invalid village id
SELECT * FROM dbo.BL_Customer WHERE OldMemberShipId NOT IN(SELECT OldMemberShipI
d FROM dbo.BL_ShareDetail) AND IsMember=1--Member with no share a/c details
SELECT * FROM dbo.BL_Customer WHERE OldMemberShipId NOT IN(SELECT distinct ltrim
(rtrim(b.items)) from dbo.BL_AccountMaster a cross apply dbo.split(a.OldMemberSh
ipId,',') as b where dbo.udfGetSchemeType(a.GLID)='SH') AND IsMember=1--Member w
ith no share a/c
------------update bl_customer set tahsilid=136
select * from bl_customer order by tahsilid desc
SELECT BranchCode,COUNT(OldAccNumber),GLID FROM dbo.BL_AccountMaster WHERE dbo.u
dfGetSchemeType(GLID)='SH'
GROUP BY BranchCode,GLID
SELECT COUNT(a.OldAccNumber),a.GLID FROM dbo.BL_AccountMaster a INNER JOIN dbo.B
L_ShareDetail b
ON a.GLID=b.GlId AND
a.BranchCode=b.BranchCode AND a.OldAccNumber=b.OldAccNumber
WHERE a.BranchCode='00064'
GROUP BY a.GLID

select * from BL_AccountMaster where BranchCode='00064' AND dbo.udfGetSchemeType


(GLID)='SH'
select * from BL_ShareDetail where BranchCode='00064' AND dbo.udfGetSchemeType(G
LID)='SH'
select * from BL_ShareDetail where GlId='833'
select * from BL_LoanMovementRegister where LandPropertyDetail is not null
select COUNT(*) FROM dbo.BL_AccountMaster WHERE BranchCode='00064' AND dbo.udfGe
tSchemeType(GLID)='SH'
select COUNT(*) FROM dbo.BL_ShareDetail WHERE BranchCode='00064' --AND dbo.udfGe
tSchemeType(GLID)='SH'
SELECT * FROM dbo.BL_ShareDetail WHERE ISNULL(NoOfShare,0)<=0 OR ISNULL(ShareAmo
unt,0)<=0 OR ISNULL(TotalAmount,0)<=0
--SELECT * FROM dbo.BL_Customer WHERE OldMemberShipId='1188M'
SELECT a.LoanAccNumber FROM dbo.BL_LoanDetails a INNER JOIN dbo.BL_LoanMovementR
egister b
ON a.BranchCode=b.BranchCode AND a.GlId=b.GlId AND a.LoanAccNumber=b.LoanAccNumb
er
INNER JOIN dbo.BL_AccountMaster c ON b.BranchCode = c.BranchCode AND
b.GlId = c.GLID AND b.LoanAccNumber=c.OldAccNumber
--count in all 3 queries must be same
SELECT COUNT(LoanAccNumber) FROM dbo.BL_LoanMovementRegister WHERE BranchCode='0
0064'
SELECT COUNT(LoanAccNumber) FROM dbo.BL_LoanDetails WHERE BranchCode='00064'
SELECT COUNT(OldAccNumber) FROM dbo.BL_Accountmaster WHERE dbo.udfGetSchemeType(
GLID)='LN' AND BranchCode='00064'
----Validate Nominee
SELECT * FROM dbo.BL_Nominee WHERE FirstName IS NULL OR FirstName=''
SELECT * FROM dbo.BL_Nominee WHERE FatherHusbandName IS NULL OR FatherHusbandNam
e=''
SELECT * FROM dbo.BL_Nominee WHERE GenderId NOT IN(1,2,3)--Nominee with invalid
gender id
SELECT * FROM dbo.BL_Nominee WHERE DOB >= dbo.PCBS_udfGetDate() OR DOB<'01-01-19
00' OR DOB IS NULL--Nominee with invalid DOB
SELECT * FROM dbo.BL_Nominee WHERE OldMemberShipId IS NULL OR OldMemberShipId=''

You might also like