SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Connect a function with a table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

shwetaatul
Starting Member

India
5 Posts

Posted - 03/30/2012 :  04:31:15  Show Profile  Reply with Quote
I have a table

create table student_Records1 (ID int not null primary key, Name nvarchar(64),Maths int,Physics int,Total int)
And i inserted the below record in the table.
insert into student_Records1 values (1,'atul','','',''),(2,'rohit','','',''),(3,'manvendra','','',''),(4,'Vishal','','','')
Now, I created a below function and i want to insert the value of blank columns in the table through the function. Please help me in this.
CREATE FUNCTION Addition5()
RETURNS Decimal(6,2)
BEGIN
DECLARE @Total Int,
@Maths Int,
@Physics Int
Set @Maths=20
set @Physics=40
SET @Total = @Maths + @Physics
insert into Student_record1
RETURN @Total
END;
GO


Atul bhardwaj

rajarajan
Starting Member

India
48 Posts

Posted - 03/30/2012 :  04:59:20  Show Profile  Reply with Quote

Functions are computed values and cannot perform permanent environmental changed to SQL Server (i.e. no INSERT or UPDATE statements allowed).
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 03/30/2012 :  17:57:30  Show Profile  Reply with Quote
you should be writing a procedure for above need

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

shwetaatul
Starting Member

India
5 Posts

Posted - 03/31/2012 :  02:53:22  Show Profile  Reply with Quote
Can you please provide me the stored procedure for this?

Atul bhardwaj
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000