SHARE
TWEET

Untitled

a guest Aug 12th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Create table Bills
  2. (
  3.   BillNo INT NOT NULL,
  4.   MeterNo INT NOT NULL,
  5.   FirstDate datetime NOT NULL,
  6.   FirstDateReading INT NOT NULL,
  7.   CurrentDate as MAX(FirstDate) CurrentDateReadng INT NOT NULL,
  8.   LastDate as DATEADD(m,-1,CurrentDate) LastDateReading INT NOT NULL,
  9.   Usageinm3 as (CurrentDateReadng-LastDateReading),
  10.   Usageinlitres as (Usageinm3 * 1000), TotalBill as (UsageinLitres * 3) Primary Key (BillNo),
  11.   Foreign Key (MeterNo) References MeterReading(MeterNo)
  12. );
RAW Paste Data
Top