Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
control_sql_-_version_history [2019/01/27 11:29] 127.0.0.1 external edit |
control_sql_-_version_history [2019/08/21 17:29] (current) dsummers |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | + | ||
===== Explanation of SQL ===== | ===== Explanation of SQL ===== | ||
- | |||
- | |||
This query will show the version history of Control based on the user login records. | This query will show the version history of Control based on the user login records. | ||
+ | There are 3 columns returned: | ||
- | |||
- | There are 3 columns returned: | ||
* FirstLogin - The first login record for the version of Control. | * FirstLogin - The first login record for the version of Control. | ||
* LastLogin - The last login record for the version of Control. | * LastLogin - The last login record for the version of Control. | ||
* VersionNumber - The version of Control. | * VersionNumber - The version of Control. | ||
+ | There are 2 variables that can to changed to adjust the date range. Changing these variables will allow you to view the version history within a specific date range.: | ||
- | |||
- | There are 2 variables that can to changed to adjust the date range. Changing these variables will allow you to view the version history within a specific date range.: | ||
* @StartDate | * @StartDate | ||
* @EndDate | * @EndDate | ||
- | |||
- | |||
===== Risk of Data Corruption if Run Improperly ===== | ===== Risk of Data Corruption if Run Improperly ===== | ||
**None**. This is a selection query and no data is modified in the running of it. | **None**. This is a selection query and no data is modified in the running of it. | ||
- | |||
- | |||
===== Query for SQL 2005 or newer ===== | ===== Query for SQL 2005 or newer ===== | ||
- | |||
- | |||
<code sql> | <code sql> | ||
Line 58: | Line 46: | ||
WHILE @@FETCH_STATUS = 0 | WHILE @@FETCH_STATUS = 0 | ||
BEGIN | BEGIN | ||
- | IF @CurrentVersion | + | IF @CurrentVersion |
SET @CurrentSeries = @CurrentSeries+1; | SET @CurrentSeries = @CurrentSeries+1; | ||
SET @CurrentVersion = @MyVersion; | SET @CurrentVersion = @MyVersion; | ||
Line 69: | Line 57: | ||
DEALLOCATE MyCursor | DEALLOCATE MyCursor | ||
; | ; | ||
- | SELECT | + | SELECT |
FROM @VersionList T | FROM @VersionList T | ||
GROUP BY Series, VersionNumber | GROUP BY Series, VersionNumber | ||
ORDER BY Series DESC | ORDER BY Series DESC | ||
</ | </ | ||
- | |||
- | |||
===== Query for SQL 2000 Only ===== | ===== Query for SQL 2000 Only ===== | ||
- | |||
- | |||
<code sql> | <code sql> | ||
Line 89: | Line 73: | ||
VersionNumber VARCHAR(15), | VersionNumber VARCHAR(15), | ||
INSERT INTO @VersionList (ID, LoginDateTime, | INSERT INTO @VersionList (ID, LoginDateTime, | ||
- | SELECT ID, StartDateTime, | + | SELECT ID, StartDateTime, |
| | ||
FROM Journal | FROM Journal | ||
Line 104: | Line 88: | ||
WHILE @@FETCH_STATUS = 0 | WHILE @@FETCH_STATUS = 0 | ||
BEGIN | BEGIN | ||
- | IF @CurrentVersion | + | IF @CurrentVersion |
SET @CurrentSeries = @CurrentSeries+1; | SET @CurrentSeries = @CurrentSeries+1; | ||
SET @CurrentVersion = @MyVersion; | SET @CurrentVersion = @MyVersion; | ||
Line 115: | Line 99: | ||
DEALLOCATE MyCursor | DEALLOCATE MyCursor | ||
; | ; | ||
- | SELECT | + | SELECT |
FROM @VersionList T | FROM @VersionList T | ||
GROUP BY Series, VersionNumber | GROUP BY Series, VersionNumber | ||
Line 121: | Line 105: | ||
</ | </ | ||
+ | ===== Version Information ===== | ||
- | |||
- | ===== Version Information ===== | ||
* Entered : 01/13/2010 | * Entered : 01/13/2010 | ||
* Version : | * Version : | ||
- | |||
- | |||