MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
You eat, breathe and sleep innovation. Build your mobile intelligence with BlackBerry® experts this July. Register Today!
  #1  
Old August 19th, 2004, 02:28 PM
psw psw is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 psw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry Column Names as Parameters

I would like to pass into a stored proc the column names I want it to return; how do I do this please?


So I pass in say:

@p_AccountNumber with a value of 'AccountNum'

and the SELECT that the sp fires is of the form

SELECT AccountNum from AccountTable

Any help appreciated

Reply With Quote
  #2  
Old August 19th, 2004, 09:58 PM
scampbell1 scampbell1 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Orange County, CA.
Posts: 6 scampbell1 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Look at sp_executesql. You can build a 'select' statement in a varchar variable in your Stored Proc and execute it.



Quote:
Originally Posted by psw
I would like to pass into a stored proc the column names I want it to return; how do I do this please?


So I pass in say:

@p_AccountNumber with a value of 'AccountNum'

and the SELECT that the sp fires is of the form

SELECT AccountNum from AccountTable

Any help appreciated

Reply With Quote
  #3  
Old August 20th, 2004, 07:19 AM
psw psw is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 2 psw User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks

Quote:
Originally Posted by scampbell1
Look at sp_executesql. You can build a 'select' statement in a varchar variable in your Stored Proc and execute it.


Thanks for the response, I have got it going now

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Column Names as Parameters


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway