Run Code
|
API
|
Code Wall
|
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
Sql server
StackOverflow_53753663
Campeonato2DLuizFelipe
MERGE WITH OUTPUT
search all tables for string
Preppin Data Challenge - Week 9
TRY_SQL
UNPIVOT
Combined Where and having
Using varaible