Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old April 28th, 2006, 10:28 AM
bubberz bubberz is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2005
Posts: 5 bubberz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 8 m 2 sec
Reputation Power: 0
Question SPROC for dynamic column???

I have the follwoing SPROC (it's not working yet):

CREATE PROCEDURE [dbo].[usp_UpdateBudgetUpdate]
@Budget decimal (18,3), @WPID nvarchar(100), @FY nvarchar(4)
AS
UPDATE Budget SET WP_Budget.+'@FY'+ = @Budget WHERE Identifier = @WPID
GO


The column WP_Budget.* can either be:
WP_Budget.FY04
WP_Budget.FY05
WP_Budget.FY06
WP_Budget.FY07
WP_Budget.FY08
WP_Budget.FY09
WP_Budget.FY10
WP_Budget.FY11
WP_Budget.FY12
WP_Budget.FY13........and up to 20

I'd like to not have to create 20 SPROCs.

Any suggestions are welcome!

Thanks!

Reply With Quote
  #2  
Old May 7th, 2006, 07:57 AM
som_dutt som_dutt is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2006
Posts: 12 som_dutt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 56 m 5 sec
Reputation Power: 0
Hi !

Why don't you write a SQL Batch that creates all the stored procedures you want at one go. Then execute it with OSQL or Query Analyzer.
Change the name of all the procedures in the same batch.
I hope you need not write the same for 20 times.


- Som Dutt

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > SPROC for dynamic column???


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 5 hosted by Hostway
Stay green...Green IT