ColdFusion CFID CFTOKEN Get lastvisit timecreated from CGLOBAL
I had a recent need to get information of CFID & CFTOKEN to see how many records we have in our datasource for CDATA, CGLOBAL and also from which date i.e. Last Min date to Last Max date the CGLOBAL table has values for. So I wrote this short query and then finally i cast the column as datetime so we can sort by date otherwise the sort will occur by string.
select cast( substring(data, charindex('ts',data) + 4 , 19) as datetime) as 'lastvisit' ,
cast( substring(data, charindex('ts',data,charindex('ts',data)+4 ) + 4 , 19) as datetime) as 'timecreated', lvisit from cglobal
where charindex('ts',data) gets the first occurrence and len('2009-08-18 22:36:55') gives you an idea of how many characters you need to extract and turns out its 19 characters.
Link to how ColdFusion Purges Client Variables
Hope this helps someone.
select cast( substring(data, charindex('ts',data) + 4 , 19) as datetime) as 'lastvisit' ,
cast( substring(data, charindex('ts',data,charindex('ts',data)+4 ) + 4 , 19) as datetime) as 'timecreated', lvisit from cglobal
where charindex('ts',data) gets the first occurrence and len('2009-08-18 22:36:55') gives you an idea of how many characters you need to extract and turns out its 19 characters.
Link to how ColdFusion Purges Client Variables
Hope this helps someone.
Comments