Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 is this possible / a good idea?

Author  Topic 

mind_grapes
Yak Posting Veteran

71 Posts

Posted - 2009-08-17 : 05:59:15
Hi all, how are you?

A new question i hope you can help with.

With Store Procedures I know you have a great deal of control, but can you do the following?

If, for example, I've created a table (table X) within a database, can I then write a SP that allows users to add a new column to table X when they want? (Incase something changes in future).

Not sure if its the best idea, as they may just add columns randomly, but was wondering if its possible.

Any info would be great.

Kind regards
MG

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-08-17 : 06:05:44
Yes, it is possible but not recommendable.



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-08-17 : 06:15:12
Hi

I think it violates the second normal form.
Eliminate Redundant Data - If an attribute depends on only part of a multi-valued key, remove it to a separate table.
The second normal form: http://www.datamodel.org/NormalizationRules.html



-------------------------
R...
Go to Top of Page

Lumbago
Norsk Yak Master

3271 Posts

Posted - 2009-08-17 : 07:49:29
It's absolutely possible by doing "ALTER TABLE mytablename ADD mynewcolumnname decimal(18, 2) NULL" but unless your writing a custom sql server management studio or something I wouldn't recommend it. What you're basically doing is to let unqualified people make modifications to your database structure and this will create a huge mess after a while...

- Lumbago
Go to Top of Page

mind_grapes
Yak Posting Veteran

71 Posts

Posted - 2009-08-17 : 09:33:36
Hi all,

Thanks for your input. I thought it may be a possibility, and equally a bad idea. Think its best that they go through me then.

Cheers everyone.

Regards
MG
Go to Top of Page
   

- Advertisement -