Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12554

updatable views

$
0
0

I  am running a job to create a  tables with timestamp like tablename_2013_02

When I open any table the data consists of that month .

 

Now I want to create a view so that when I execute a view it shows up all the data of all months.

 

In general

The code should be

SELECT     SiteID, DateTime, TankNumber, ProductCode, DeliveryInProgress, LeakTestInProgress, InvalidFuelHeightAlarm, Volume, TCVolume, Ullage, Height, Water,

                      Temperature, WaterVolume

FROM         dbo.SiteInTankReports_2013_02

UNION ALL

SELECT     SiteID, DateTime, TankNumber, ProductCode, DeliveryInProgress, LeakTestInProgress, InvalidFuelHeightAlarm, Volume, TCVolume, Ullage, Height, Water,

                      Temperature, WaterVolume

FROM         dbo.SiteInTankReports_2013_03

 

How to add april month code to view automatically

Like this

 

SELECT     SiteID, DateTime, TankNumber, ProductCode, DeliveryInProgress, LeakTestInProgress, InvalidFuelHeightAlarm, Volume, TCVolume, Ullage, Height, Water,

                      Temperature, WaterVolume

FROM         dbo.SiteInTankReports_2013_02

UNION ALL

SELECT     SiteID, DateTime, TankNumber, ProductCode, DeliveryInProgress, LeakTestInProgress, InvalidFuelHeightAlarm, Volume, TCVolume, Ullage, Height, Water,

                      Temperature, WaterVolume

FROM         dbo.SiteInTankReports_2013_03

UNION ALL

SELECT     SiteID, DateTime, TankNumber, ProductCode, DeliveryInProgress, LeakTestInProgress, InvalidFuelHeightAlarm, Volume, TCVolume, Ullage, Height, Water,

                      Temperature, WaterVolume

FROM         dbo.SiteInTankReports_2013_04

 

Is it possible or is there way to do it can you help me in this or give me hint so that I ll try

Many thanks


Viewing all articles
Browse latest Browse all 12554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>