Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Blog
IOU
CREATE TABLE Debts ( InitialDebt DECIMAL(6,2), InitialDate DATETIME, CurrentDate DATETIME, Interest DECIMAL(6,2) ) INSERT Debts (InitialDebt, InitialDate, CurrentDate, Interest) SELECT 33, '09/06/2019', GETDATE(), 10 ALTER TABLE dbo.Debts ADD CalculateDebt AS (InitialDebt + (InitialDebt*Interest/100/DAY(EOMONTH(GETDATE()))) * DATEDIFF(DD, InitialDate, CurrentDate)) SELECT InitialDebt, InitialDate, CurrentDate, DATEDIFF(DD, InitialDate, CurrentDate) AS PayableDays, Interest, DAY(EOMONTH(GETDATE())) AS DaysInMonth, CAST(CalculateDebt AS DECIMAL(6,2)) AS PayToCreditor FROM Debts
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
a
Mass Insert using Except
Update using a temp table
New_1
IOU2
SO_20171230_SqlServer
All the k-mers/n-grams
Task_5_Final
Loan37
SQL_Joins_RankingFunctions
stackse - search stackoverflow differently
Please log in to post a comment.