• rama.king127 (4/17/2013)


    A string contains 3,4 suppose I want to store 3 in one parameter and 4 in another parameter similar in c# like arr[0] and arr[1]? how can i achieve it

    Think outside the box, the sql way like this...

    set nocount on;

    declare @sqlArray table (id int identity(1,1), item int)

    insert into @sqlArray(item)

    select 3 union all

    select 4;

    declare @x int=1, @arrayLength int, @curItem int

    select @arrayLength=MAX(id) from @sqlArray;

    --now loop thru your array =)

    while @x <= @arrayLength begin

    select @curItem = item from @sqlArray where id=@x;

    print @curItem;

    set @x= @x+1;

    end