Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

dynamic view query

$
0
0
I have a view created from only one table.
VW_Stats ( Tab_Name,Load_Status,User,....)

Tab_Name & Load_Status columns provides the information about Name of table and status of data getting loaded to this table,
The Stats table from which the view is created, is used for capturing the current data load stats, the data is being loaded in to several tables from source, I am trying to get the number of records loaded into each table during the data load still running.

Select * from Vw_Stats

Table_name        Load_Status       User...
tbl_collection       Running              XYZ

To this I would like to add a column to display the running count in the table, I mean how many records so far loaded, as below the recordCount coming from the same table tbl_collection

Table_name        Load_Status       RecordCount          User...
tbl_collection       Running              1244                      XYZ


is this possible?

create view vw_stats(
Table_name,
Load_status,
(Select count(*) from Table_name) as RecordCount,  -- I would like to know how to make this work
User,
from tbl_stats



-Neil


Viewing all articles
Browse latest Browse all 8428

Trending Articles



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