I have small doubt on getting data from table with stored procedure based on parameters from user.i have this table
empno ename
1 hari
2 kumar
1 pavan
1 naveen
But want to get data in this way
empno ename
1 hari,pavan,naveen
2 naveen
and also from the user he will pass colname for order by.
Satyapriya NayakPosted Dec 26, 2012, 5:31 AM
((SELECT TOP (100) PERCENT ', ' + ename AS Expr1
FROM employee AS t
WHERE (employee.empno = empno)
ORDER BY empno, ename FOR XML path('')), 3, 1000) AS Expr1
FROM employee
GROUP BY empno
Santhosh Kumar JayaramanPosted Dec 26, 2012, 5:14 AM
Amit ChoudharyPosted Dec 26, 2012, 5:10 AM
If you are using EntityFramework, You can use Function Import to call storeporcedure which will create a function with arguments as you have in your StoredProcedure.
Hope this was helpful.
venkata kumarPosted Dec 26, 2012, 4:56 AM
check fallowing link
https://www.google.co.in/#hl=en&tbo=d&spell=1&q=how+to+combine+multiple+lines+into+single+line+in+sql+server+2005&sa=X&ei=9MbaUKPZJ8forAft54Fg&ved=0CDAQBSgA&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&bvm=bv.1355534169,d.bmk&fp=763f662d365af90a&bpcl=40096503&biw=1787&bih=860