Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

Query Analyzer Setup

To setup Query Analyzer on your workstation, follow the steps below.

1. Create a Folder on your hard drive called Query Analyzer. Now navigate to this
directory: \\boc001fs\apps\SQLServer-Client\Tools. Copy the entire tools folder and
paste into the Query Analyzer folder you just created on your workstation(see below)

2. In the Tools folder, highlight the isqlw.exe file(this is the executable to run Query
Analyzer), righ-click and choose Create Shortcut. You can cut/paste this shortcut to your
desktop as a quick way to start up Query Analyzer.

3. Double-click the Query Analyzer shortcut you just created in step 2. Set the SQL
Server database name to BOC003SQL. Choose whether your using your windows
authentication(network userid/pw) or SQL Server authentification(database login id/pw).
Click OK.

4. Make sure that the database your connecting to is mdb. This is the SD
database. You can start running SQL. An example of 2 SQL selects used for 2
reports our group is currently getting is below. These 2 reports show tickets
closed yesterday and also over the past 7 days. This is a good start to get
familiar with the tables/fields.

To run SQL, click the button.


Example SQL:
---7 Day Report SQL----------------------------------------------------------------------

SELECT
d.ref_num 'SDR',d.status 'STAT',
a.first_name 'First Name',a.last_name 'Last Name',p.sym 'Request Area',r.sym 'Root Cause',pr.sym
'Priority',
dateadd(ss,d.open_date, '01-01-1970 00:00:00') 'Open date',
dateadd(ss,d.close_date, '01-01-1970 00:00:00') 'Close date',
---dateadd(ss,al.time_stamp, '01-01-1970 00:00:00') 'Close by dt',
bb.first_name 'Closed by Fname',bb.last_name 'Closed by Lname',al.type 'Stat1', d.summary
from mdb.dbo.ca_contact a,mdb.dbo.call_req d, mdb.dbo.cr_stat s,mdb.dbo.prob_ctg
p,mdb.dbo.rootcause r,
mdb.dbo.pri pr,act_log al, ca_contact bb
--OUTER(mdb.dbo.rootcause r )
where s.code = d.status
and a.contact_uuid = d.assignee
and d.category = p.persid
and pr.enum = d.priority
and r.id =* d.rootcause ----works as an outter
and al.analyst = bb.contact_uuid
and d.persid = al.call_req_id
and al.type = 'Cl'
and (( dateadd(ss,d.close_date,'01-01-1970') >=convert(varchar,
getdate()-7,101 ) )
and (( dateadd(ss,d.close_date, '01-01-1970') < convert(varchar,
getdate(),101 ) ))
or d.close_date IS NULL)
and (d.status = 'CL'
or d.status = 'NTF'
or d.status = 'CLUNRSLV') and (p.sym like 'CLINFORCE.Peoplesoft%'
OR p.sym like 'Financials%'
OR p.sym like 'HR Mgt%'
and (p.sym not like '%Financials.Performance%')
and (a.first_name not like 'CLHELP%' and bb.first_name not like 'Jill%')) --new row added--
--and d.ref_num = '68469'
order by 1, 5,2;

---Daily Report SQL-----------------------------------------------------------

SELECT
d.ref_num 'SDR',d.status 'STAT',
a.first_name 'First Name',a.last_name 'Last Name',p.sym 'Request Area',r.sym 'Root Cause',pr.sym
'Priority',
dateadd(ss,d.open_date, '01-01-1970 00:00:00') 'Open date',
dateadd(ss,d.close_date, '01-01-1970 00:00:00') 'Close date',
---dateadd(ss,al.time_stamp, '01-01-1970 00:00:00') 'Close by dt',
bb.first_name 'Closed by Fname',bb.last_name 'Closed by Lname',al.type 'Stat1', d.summary
from mdb.dbo.ca_contact a,mdb.dbo.call_req d, mdb.dbo.cr_stat s,mdb.dbo.prob_ctg
p,mdb.dbo.rootcause r,
mdb.dbo.pri pr,act_log al, ca_contact bb
--OUTER(mdb.dbo.rootcause r )
where s.code = d.status
and a.contact_uuid = d.assignee
and d.category = p.persid
and pr.enum = d.priority
and r.id =* d.rootcause ----works as an outter
and al.analyst = bb.contact_uuid
and d.persid = al.call_req_id
and al.type = 'Cl'
and (( dateadd(ss,d.close_date,'01-01-1970') >=convert(varchar, getdate(),101 ) )
or d.close_date IS NULL )
and (d.status = 'CL'or d.status = 'NTF' or d.status = 'CLUNRSLV')
and
(p.sym like 'CLINFORCE.Peoplesoft%'
OR p.sym like 'Financials%'
OR p.sym like 'HR Mgt%' )
and (p.sym not like 'Financials.Performance%')
and (a.first_name not like 'CLHELP%' and bb.first_name not like 'Jill%')
order by 1, 5,2;

----------------------------------------------------------------------------------------

You might also like