Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
IOU2
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.
sql_fb
New
1D Hotel
MERGE with OUTPUT
Create Date list (variable dates) - SQL Server
MyShopSchema
nikesh
Sql Server's curse
2021-03-09_LeetCodeSQL
https://www.hsbc.co.in/ways-to-bank/online-banking/9247/
Please log in to post a comment.