I am using sql server as back-end for developing my application in asp.net c#. Now i need to create a table with an auto calculating column(closing balance) as shown below:<
Seems to me like you don't need really need recursion...
CREATE FUNCTION dbo.GetClosingBalance(@Date date) RETURNS int AS
BEGIN
DECLARE @RetVal int
SELECT
@RetVal = SUM([in stock]) - SUM([out stock])
FROM
x
WHERE
[Date] <= @Date
RETURN @RetVal
END
ALTER TABLE x ADD COLUMN [closing balance] AS (dbo.GetClosingBalance([Date]))