Home |
Select historical data |
Select current data
|
Use DataInterface.SelectHistorical, as demonstrated in the following code sample. For more information, see the documentation.
//Select companies where CompanyID=12 at Jan 1, 2006
DataTable result = dataInterface.SelectHistorical(
"tblCompany", new DateTime(2006, 1, 1), "CompanyID=12");
Use CLR_SqlRetroview_SelectHistorical, as demonstrated in the following code sample.
--Select companies where CompanyID=12 at Jan 1, 2006
EXEC dbo.CLR_SqlRetroview_SelectHistorical 'tblCompany',
'2006.01.01', 'CompanyID=12'
Most convenient. Due to some peculiarities in SQL Server 2005, this method (using table-valued UDF's) is less efficient then the method using procedures on very large datasets. We hope that future releases of SQL Server will resolve this issue.
--Select companies where CompanyID=12 at Jan 1, 2006
SELECT * FROM dbo.tblCompany_Historical('2006.01.01')
Most efficient.
--Select companies where CompanyID=12 at Jan 1, 2006
CREATE TABLE #results (
CompanyID int,
CompanyName varchar(255),
Phone varchar(255),
TimeZoneID int
)
INSERT #results EXEC sp_tblCompany_Historical '2006.01.01'
SELECT * FROM #results WHERE CompanyID=12
DROP TABLE #results