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
 SQL Server 2005 Forums
 .NET Inside SQL Server (2005)
 help with parameter values in stored procedure

Author  Topic 

roxcy
Yak Posting Veteran

58 Posts

Posted - 2007-06-26 : 01:48:40
Hi,
I am using a stored Procedure where I am passing some parameter values.Following is my Code.

CREATE proc Usp_Rpt_GetDetails
@Fromdt varchar(12),
@ToDt varchar(12),
@ApscId numeric,
@StatusCode varchar(1),
@val numeric
as

Begin

if @StatusCode = "C" then @ vall(1,2)

End
select
'' as unuseid,
substring(ltrim(rtrim(s.Spares_Code)),1,12) as Code,
oh.WO_Number AS Claim_Id,
ltrim(rtrim(sc.section_code)) AS section_code,
ltrim(rtrim(dc.defect_code)) AS defect_code,
ltrim(rtrim(at.Action_Taken_Code)) AS Repair_Code,
cs.Call_status_code
from [32_Trans_Work_Order_Spares_Detail] ws
inner join [32_Trans_Work_Order_Header] oh on oh.WO_Number = ws.WO_Number
inner join [11_Master_Spares]s on s.Spares_ID = ws.Spares_ID
inner join [31_Master_Section_Code] sc on sc.Section_ID = ws.Section_Code_ID
inner join [31_Master_Defect_Code] dc on dc.Defect_ID = ws.Defect_Code_ID
inner join [10_Master_Equipment_Status] e on e.Equipment_Status_ID = oh.Equipment_Status_ID
inner join [00_Master_Country] c on c.Country_ID = mp.Country_ID
where e.Equipment_Status_ID in (1,2) and cs.Call_Status_ID in (1,2) and oh.WO_Record_Date between @Fromdt and @ToDt
and oh.WO_Status='C'


My Problem is How to pass values to parameters
Status Code Consists of values C, V, R which i am passing from the Front End
along with Call_Status_ID which can be 1,2.

Thanks ...

JoeNak
Constraint Violating Yak Guru

292 Posts

Posted - 2007-08-16 : 10:02:42
I'm not really sure what you're asking here... It would help, if you explained it further.

I'm also not sure what you're trying to do with your if statement. I think you're looking for

If @statusCode = 'C'
Set @val = ?? --can't set a numeric value to multiple values
Go to Top of Page
   

- Advertisement -