Click here to Skip to main content
15,922,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

how would i return a collection or any object or multiple columns in procedure. Is there any way of doing this.

suppose i have 80 columns value to return by a procedure... than how would i be ?
Posted
Updated 17-Jun-12 23:37pm
v2

Something like this:

SQL
USE MyDataBase;
GO
CREATE PROCEDURE dbo.MyStoredProc
AS
    SELECT ColumnA, ColumnB, ColumnC, ColumnD..., ColumnZ FROM MyTable
GO


OR am I missing something?
 
Share this answer
 
Comments
punkiv 18-Jun-12 5:41am    
here that MyTable is a already defined table or we will create it on fly.
and what is use of " USE MyDataBase;" here.
Manas Bhardwaj 18-Jun-12 6:05am    
Use MyDatabase directs the SQL Server to use the DB where you want to create the Stored Proc.
Doesn't really matter if you use Temp tables, you can always return the values using SELECT.
Prasad_Kulkarni 18-Jun-12 6:00am    
5'ed!
Manas Bhardwaj 18-Jun-12 6:03am    
Thanks!
simple create store procedure and write your select query. it will give you your desired result.

SQL
create proc UrProcedureName
@Param DataType=null
as
begin
select * from UrTableName where urCondition
end
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900