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
 SQL Server 2005 Forums
 Transact-SQL (2005)
 delete column used in calculated column

Author  Topic 

coder
Starting Member

16 Posts

Posted - 2007-05-18 : 08:01:46

Hi,

What happens if the user accidentally deletes a column that is used in a calculated column?

For example, let's say I have a calculated column whose value is (Column1 + Column2) * (Column5 + Column10). Let's say the user tries to delete Column10. Will the server throw an exception? What is a good way to handle this scenario? Thanks1

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-05-18 : 08:11:23
Do you think SQL Server is that dumb that it will allow the column which is referenced by a computed column, to be deleted?

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2007-05-18 : 09:55:36
why in the WORLD would you allow a user that kind of access to your database? at MOST the user should be allowed to execute a stored proc, or MAYBE select from certain tables.

[Signature]For fast help, follow this link:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx
Learn SQL
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

rudesyle
Posting Yak Master

110 Posts

Posted - 2007-05-18 : 10:52:59
You'd get an error like " Error validating the formula for column 'num3'." if you tried to delete it.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-05-18 : 11:01:14
<<
What happens if the user accidentally deletes a column that is used in a calculated column?
>>

deletes or drops?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -