Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Store Proc. Help Please..

Author  Topic 

Kishore Adurty
Starting Member

1 Post

Posted - 2008-08-31 : 14:21:30
Dear SQL Gurus,

When I execute below proc with @OneViewID =”N”

It should display all rows with OneViewID like ‘%N%’


Its only returning one row,

the one with MNNN is not showing.

Can you please tell me if there is somthing wrong with above
procedure..

Appreciate all your help..

TIA
Kish.



Here is the Table:

OneViewID BusUnit Segment AccountName OneViewEngDescr Region AccountMD

1- ABCXYK PS CIVILIAN Aggrieva Aggrieva BPA Recompete US Derek Johnson

1-IONZD7 PS DEFENSE MPTE MPTE CIO US Marc

1-L0F0P PS CIVILIAN FBI FBI US Susan

1-MMMN6 PS SLED OCC FBI

1-MMOE5 PS SLED BPAS BPAS - Teachers Retirement US Kathy

1-P64U1 PS HEALTHCARE PACS Professional Assistance and Consulting Services US Susan

1-PL59L PS CIVILIAN OCC OCC IDIQ/STARS US Brien

1-Q5Y2J PS SLED GIS GIS Re-write and Maintenance US Jim
=====================================

Stored Proc:

CREATE Procedure sp_OneViewResultSet

(

@OneViewID varchar (10) =null,

@OneViewName varchar (50) = null,

@Segment varchar (50) = null,

@Solutions varchar(20) = null,

@AccountMD varchar(50) = null,

@ContractType varchar(20) = null,

@PrimeSub varchar(50) = null,

@FirstDate datetime = null,

@EndDate datetime = null



)

AS



BEGIN



SELECT GeneralData.OneViewID as [OneView ID], GeneralData.OneViewEngDescr as [OneView Engagement Description], GeneralData.AccountMD as [Account MD], GeneralData.Segment, GeneralData.Solutions, GeneralData.ContractType as [Contract Type], OpportunityAssessCriteria.PrimeSub as [Prime/Sub] FROM GeneralData INNER JOIN OpportunityAssessCriteria ON GeneralData.OneViewID = OpportunityAssessCriteria.OneviewID

WHERE

(GeneralData.OneViewID LIKE '%' + ISNULL(@OneViewID, GeneralData.OneViewID) + '%') AND

(GeneralData.OneViewEngDescr LIKE '%' + ISNULL(@OneViewName , GeneralData.OneViewEngDescr) + '%')AND

(GeneralData.Segment LIKE '%' + ISNULL(@Segment, GeneralData.Segment) + '%') AND

(GeneralData.Solutions LIKE '%' + ISNULL(@Solutions, GeneralData.Solutions) + '%') AND

(GeneralData.AccountMD LIKE '%' + ISNULL(@AccountMD, GeneralData.AccountMD) + '%') AND

(GeneralData.ContractType LIKE '%' + ISNULL(@ContractType, GeneralData.ContractType) + '%') AND

(OpportunityAssessCriteria.PrimeSub LIKE '%' + ISNULL(@PrimeSub, OpportunityAssessCriteria.PrimeSub)+'%')

order by GeneralData.OneViewEngDescr

end

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-01 : 00:02:40
dont use double quotes use like below

@OneViewID ='N'
Go to Top of Page
   

- Advertisement -