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
 Database Design and Application Architecture
 Can i use Computed Field in SQL

Author  Topic 

Arunavally
Yak Posting Veteran

58 Posts

Posted - 2013-11-14 : 01:46:06
My table MEMBER_REGISTRATION has MemberId field is a computed field.

But i used my query like

if @position='Left'
update MEMBER_REGISTRATION set LEFTJOIN=@memberid where MEMBERID=@sponsor
else
update MEMBER_REGISTRATION set RIGHTJOIN=@memberid where MEMBERID=@sponsor

But i got error.

The column "MEMBERID" cannot be modified because it is either a computed column or is the result of a UNION operator.

I dont knw how use it.
Kindly help me.

Thanks in advance

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2013-11-14 : 01:58:41
can you show us the DDL for MEMBER_REGISTRATION ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-11-14 : 02:21:55
can you explain what you're trying to do?
Both of your posted statements make no sense

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Arunavally
Yak Posting Veteran

58 Posts

Posted - 2013-11-14 : 10:22:12
Sorry
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2013-11-14 : 10:39:18
couple things:

- a computed column can not be modified. To modify the value you would need to modify the column value(s) that are involved in the definition expression.

- the error you specified doesn't match up with the statements you posted. That error indicates that you are updating the [memberid] column but neither statement is modifying that column.

Be One with the Optimizer
TG
Go to Top of Page

Arunavally
Yak Posting Veteran

58 Posts

Posted - 2013-11-14 : 11:20:24
Thank you
Ya. Thats why Iam asking.
Go to Top of Page

Paul J. Brooks

7 Posts

Posted - 2013-11-25 : 06:16:50
Yes you can use the computed Field in SQL.I wanna discus on this topic if any one interested then reply me i m waiting.I think this is a good approach.Thanks for sharing this information.

-----------------

unspammed
Go to Top of Page
   

- Advertisement -