Jump to content

Sql Store Procedure Dout Urgent..!


Recommended Posts

Posted

Multiple values pass cheyyali parameters lo kinda example undi soodandi..

for eg: [b]E[/b][b]x[/b][b]e[/b][b]c[/b][b]P[/b][b]r[/b][b]o[/b][b]c[/b][b]@[/b][b]p[/b][b]1[/b][b]=[/b][b]1[/b][b],[/b][b]@[/b][b]p[/b][b]2[/b][b]=[/b][b]A[/b] ani pass chestey naku count 10 ani vastundi, but I want to pass like [b]Exec Proc @p1=1[/b][b],[/b][b]2[/b][b],[/b][b]3[/b][b],[/b][b] @p2= A,B,[/b][b]C[/b]I need to get 30 for total values. single value istey vastundi but multiple istey raavatledu em cehyyali procedure lo any Idea

Helf please

Posted

should not be a problem

Aa values single quotes lo ichhava??

Posted

ni proceedure lo unde body logic ikkada veyi maayya..

Posted

DECLARE @SplitOn varchar(2)
DECLARE @List varchar(5000)
Declare @Count int
Declare @TEMPTABLE Table
(
Value varchar(2500)
)

SET @List=@Order_Number --Your Parameter
SET @SplitOn =','
SET @Count=0
While (Charindex(@SplitOn,@List)>0)
Begin
Insert Into @TEMPTABLE (Value)
(
Select
Value = ltrim(rtrim(Substring(@List,1,Charindex(@SplitOn,@List)-1)))

)
Set @List = Substring(@List,Charindex(@SplitOn,@List)+len(@SplitOn),len(@List))

End

Insert Into @TEMPTABLE(value) select @List

Posted

The above code works if you are passing multiple values separated by a comma. In your body of the SP, use @temptable in place of original parameter.

Posted

got it friends, adi just datatype length takkuva ichaanu indaaka penchitey vacheysindi.

@All Thanks for your replies

×
×
  • Create New...