Sach writes "Hi , My requirement is peculiar . Following is the signature of a stored procedure :::procedure get_csv( @I_Table VARCHAR(200), @v_csv_data varchar(8000) output)
This procedure accepts the name of a table as parameter and returns all rows in this tables in form of CSV string . eg Table Mytable col1 col2 col3 col4 1 abcde pqrst 4 1 abcde pqrst 4 1 abcde pqrst 4
should end up as col1,col2,col3,col4 1,abcde,pqrst,4 1,abcde,pqrst,4 1,abcde,pqrst,4
and this will be assigned to @v_csv_data . I tried in vain using information_schema.columns view and cursors. But since the column names are also obtained dynamically I had problems fetching from cursor into variables.Thanks in advance for any insight ."