473,387 Members | 1,844 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Extract Data from Event Description

I'm trying to track the logon/off times for Users using certain Event ID's. The entry/example below is the Event Description which is contained in a single cell within my table/report. I need to create a simple query that will extract the Logon ID (just the numbers) - so for the example below, the output would simply be 0x0,0x13BBA434.
I've investigated the Mid function but you need a starting position... Unfortunately the start position will be different for each cell of data and so the query needs to simply extract what is in between the parenthesis for every entry within the column.

Event Description

Successful Network Logon:
User Name: smithj
Domain:
Logon ID: (0x0,0x13BBA434)
Logon Type: 3
Logon Process: Kerberos
Authentication Package: Kerberos
Workstation Name:
Logon GUID: {29492761-2f71-9589-8c1d-d9c51fad1732}
Caller User Name: -
Caller Domain: -
Caller Logon ID: -
Caller Process ID: -
Transited Services: -
Source Network Address: -
Source Port: -
Mar 2 '07 #1
5 2179
nico5038
3,080 Expert 2GB
Try:

select mid(yourfield,instr(yourfield,"("),instr(yourfield ,")")-instr(yourfield,"(")) as EventDescr from tblYors

This will retrieve all between the "(" and ")" and will only work when no other fields before the EventID hold parentheses...

Nic;o)
Mar 3 '07 #2
NeoPa
32,556 Expert Mod 16PB
A reworked version to match the LogonID only in the format specified :
Expand|Select|Wrap|Line Numbers
  1. SELECT Left([sLogonID],InStr([sLogonID],')')-1) AS LogonID
  2. FROM (SELECT Mid([YourField],InStr([YourField],'Logon ID: (')+11,99) AS sLogonID
  3.       FROM tblYours)
This uses a subquery as doing this directly in SQL is certainly awkward. VBA would handle this sort of thing a lot better, but SQL will crunch through the records better of course.
Mar 5 '07 #3
Thank you both for the replies... Now lets say that my report (created in Visual Studio) contains the following information:

Column A: Logon/Off Times for Users
Column B: User Name/ID
Column C: Server Name
Column D: Event ID
Column E: Logon ID (the one that was extracted)

Every 'Logon ID' (the one that was extracted) will have a match. See examples below (Rows 1 and 3 on my report are a match - based on Logon ID):

Row 1
Column A: 3/13/07 10:00 AM
Column B: SmithJ
Column C: SQLSERVER01
Column D: 540 (logon)
Column E: 0x0,0x13BBA434

Row 2
Column A: 03/11/07 1:00 PM
Column B: JonesM
Column C: SQLSERVER01
Column D: 540 (logon)
Column E: 0x0,0x13QFG450

Row 3
Column A: 10:15 AM
Column B: SmithJ
Column C: SQLSERVER01
Column D: 538 (logoff)
Column E: 0x0,0x13BBA434

So i now need a query that will find a match for every LOGON ID (Column E). There will never be more than two occurances of the logon id but there may be instances where the logon id doesn't have a match (i.e. the report only captured the logon event and not the logoff event - null). Once the query finds the match, it will further need to compute the time difference contained in Column A. For the example above, the time difference would be 15 mintues. I am only concerned with logon sessions that exceed 3 Hours and that are conducted by certain Users. So the end result of the report will only produce those sessions that exceed 3 hours... Am I dreaming? Thanks -
Mar 13 '07 #4
nico5038
3,080 Expert 2GB
You'll need to start with a groupby query on the column E and with a MAX() and MIN() function for column A like:

select E, Min(A) as StartTime, Max(A) as EndTime from tblYours;

This query can than be used for determning the difference between Min and Max.

Getting the idea ?

Nic;o)
Mar 13 '07 #5
NeoPa
32,556 Expert Mod 16PB
I'm not sure this can be done simply in SQL. I'm assuming here, from what you say, that multiple logons can appear for the same ID and that, even within that, you cannot guarantee a matching logoff for every logon. You may need to consider processing through the dataset in VBA.
Mar 13 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: Zhang Le | last post by:
Hello, I'm writing a little Tkinter application to retrieve news from various news websites such as http://news.bbc.co.uk/, and display them in a TK listbox. All I want are news title and url...
0
by: Shakil Khan | last post by:
Hi there ... My question is about Meta Data which is automatically saved with files. For example,when an MS Office Documents is saved, it automaticaly save some extra information with the file...
4
by: sheree | last post by:
I have 3 tables (amoung a few others) in a small access database. The tables are as follows: == AEReport -------- AEID (PK) RptCatelog GCRCID PatientID EvntDate
1
by: Tomek Kmiecik | last post by:
Hello! I'm writing simple database application. One table in the database stores some information about keywords (among other, keyword name, id number and description). Description is stored in...
1
by: caine | last post by:
I want to extract web data from a news feed page http://everling.nierchi.net/mmubulletins.php. Just want to extract necessary info between open n closing tags of <title>, <categoryand <link>....
1
by: steveyjg | last post by:
I want to extract the following data from a retrieved html file and store the information as strings. 'get the text of "title" <h1 id="test_title">title</h1> 'get the contents of the value...
4
by: Rick | last post by:
I've moved code from a stage machine to the production machine, exact same code works fine on the stage machine, they are both windows 2003 servers, I'm getting a "Cannot generate SSPI context"...
10
by: spoken | last post by:
Hi, I quite new to Javascript and XML. Here a is snippet of my XML file. <xml> <cd> <rock> <item id='1'> <name>Bon Jovi</name> <price>$10</price>
1
by: bhavinnaik | last post by:
Hi I am new to the IT enviro...although i've used QSL query for a while now but on simple or single queries. Here is the problem... I've got two queries looking at a set of tables to extract the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.