Reply to Re: How to pass table names to a Stored procedure

Your name:

Reply:


Posted by David Portas on 12/17/05 17:06

adi wrote:

> Hi all,
> Seems like a fundamental question to me but I dont have a definite
> answer for it, Gurus please enlighten me.
>
> I have a table 'Table1' whose structure changes dynamically based on
> some configuration values from another table. This table is being used
> by a program, It was initially used by this program which ran as a
> single task (executing at only a specific interval) but now the program
> has to be run mutiple times some coinciding with each othe - which
> meant that table structure will change as 2 programs are running
> simultaneously... and therefore I have decided to use seperate table
> names that each has a structure of its now.
>
> I use this table name 'Table1' in about 10-15 stored procedures and
> UDF's
>
> to make the long story short: Since I will not know which table I will
> be using in the program I want to pass the table name as an argument to
> the SP and UDF's and then access this param in the
> 'select's/updates/inserts' - but this doesn't work unless I use Dynamic
> SQL.
>
> Is there any other way of passing table names as parameters and then
> using then in the procs?
>
> any ideas will be really helpful.
> adi

I have to agree with Daniel. This sounds like a mess and not the way to
build any kind of scalable or reliable solution. Dynamic SQL may buy
you some time but I'd only go that route as a last resort and only as a
stop-gap for some better plan.

--
David Portas
SQL Server MVP
--

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация