TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jolly Priya
NA
16
13.2k
how to add computed columns in sql??
Jun 5 2013 2:52 AM
How to add two computed columns in sql ??
I am using visual studio 2010 ,where i have created the database by using server explorer.Now i want to add two columns which are already computed.
e.g
i have columns like
so i want deduction should be pf+it+medicalallwnceded where pf is computed column as 0.25* salary
i m getting error :Unable to modify table.
Computed column 'pf' in table 'Tmp_ps' is not allowed to be used in another computed-column definition. where ps is the table name.
also i tried by using function
my function is:
CREATE FUNCTION [dbo].[deduction](@pf Float ,@it Float , @medicalallwnceded Float )
RETURNS FLOAT
AS
BEGIN
DECLARE @deduction Float
SET @deduction = @pf + @it + @medicalallwnceded
RETURN
@deduction
END
where i m getting error like - Unable to modify table.
Must declare the scalar variable "@pf".
Reply
Answers (
2
)
STORED PROCEDURE
How to select all parent id in sql ?