need procedure to calculate trial | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

need procedure to calculate trial

Dear Friends,
i am new to sql server 2000. well, i have tried to some work and it is done.
now i am in need to have procedure to calculate trial.
well,
i go tables as follow 1. maincode
mcodeid identity
acode varchar(11)
ahead varchar(11)
userid int
yearid int
fdate datetime
2. subcode
mcodeid int
scodeid identity
rest are same as maincode
3. detailcode
dcodeid identity
mcodeid int
scode int
opdebit money
opcredit money
rest are same as maincode
4. master
id identity
vdate smalldatetime
vtype varchar(2)
vnumber int
userid int
yearid int
fdate datetime
5. detail
id int
narration varchar(125)
dcodeid int
debit money
credit money
now i need following thing to do
remember from program i will provide start date and end date to calculate
trial
let us say if program starts from 01/07/2004 to 30/06/2005
1. we provide date from 01/07/2004 till today
if should check opening in detail code and current transactions
in detail table as curdebit or curcredit than calculate closing
2 if we provide date from 01/08/2004 till today
now it should check opening and calculate 7th month transactions as openening
than from 01/08/2004 till today to calculate current transactions
the format required is
acode, ahead, opdebit, opcredit, curdebit, curcredit, cldebit, clcredit
i will be thank full to you for your help Abdul Aqeel Malik

Please post sample data and required output. I’m pretty sure I understand you, but some more informations doesn’t hurt anyway. [<img src=’/community/emoticons/emotion-1.gif’ alt=’:)‘ />]<br /><br />–<br />Frank Kalis<br />Microsoft SQL Server MVP<br /<a target="_blank" href=http://www.insidesql.de>http://www.insidesql.de</a><br />Ich unterstütze PASS Deutschland e.V. <a target="_blank" href=http://www.sqlpass.de>http://www.sqlpass.de</a>) <br />
Hi i feel the table design is needs to be denormalized more.
As u have many common fields in the first three tables.
I feel those are not required.
as said by frank, list ur sp with few data examples.
thanks for your reply
may i know how should it be denormalized more.
i am using the refrence of maincode in subcode table and than
subcode in detial code table
what is your view to make it more denormalized. Dear Mr. Frank
i think you understand what i want to do.
would you please put some records in it by yourself
and i have mentioned output that is required to me
output should like this acode, ahead, opdebit, opcredit, curdebit, curcredit, cldebit, clcredit i need following thing to do
remember from program i will provide start date and end date to calculate
trial
let us say if program starts from 01/07/2004 to 30/06/2005
1. we provide date from 01/07/2004 till today
if should check opening in detail code and current transactions
in detail table as curdebit or curcredit than calculate closing
2 if we provide date from 01/08/2004 till today
now it should check opening and calculate 7th month transactions as openening
than from 01/08/2004 till today to calculate current transactions
the format required is
waiting for your quick and detailed reply if will be thankfull to one who can send me some database sample for accounts
along with procedure and etc.

]]>