7. Lifehack: Start 2014 with a jar and fill it
with notes of good things that happen
Next New Year’s Eve, empty the jar and see what awesome
stuff happened that year.
8. Performance: Check for heaps/clustered
indexes
SELECT t.[Name] FROM sys.Indexes i
JOIN sys.Tables t
ON t.Object_ID = i.Object_id
WHERE i.type_desc = 'HEAP'
ORDER BY t.[Name]
9. Performance: Index all the keys
select object_name(c.object_id), c.name from sys.columns c
where c.name like '%id'
and c.object_id not in
(
select object_id
from sys.index_columns
)
10. Lifehack: Readable Presentations
Take the average age of the people in your audience and
divide by 2: That’s your font size
Do you want to know what I think you’re average is? My font size is
typically 20 – 24.
13. Power BI - Visualization: Use color
sparingly.
In nature, colors do two things:
1) Entice
2) Warn
So let’s use them sparingly..
WARNING: POISON FROG!
28. Tip: Life is so easy with a dates table
Find the sales numbers for the first Monday of every month
of the year
T-SQL with no dates table
T-SQL with dates table
34. SSRS: Log, Log, Log (and beware of
subscriptions)select c.Name
, e.InstanceName
, e.UserName
, e.Parameters
, e.TimeStart
, e.TimeEnd
, e.TimeDataRetrieval
, e.TimeProcessing
, e.TimeRendering
from executionlog e
join catalog c
on e.reportid = c.ItemID
Send a Link, or a file on a shared folder that you can audit. Find someway to audit who opened the link or the file
in the folder. Try to avoid sending the PDF without a way to audit it.
35. Performance: Big lines
When troubleshooting, thick rows means lots of data, thin rows mean not much data.
You’re probably better off following the thick rows.
37. SSRS: Store colors in the database
Colors = Business Logic
Put it in the database
Use Expressions to read the colors
Include action colors and levels
38. SSRS: Get Buy-in to Export to Single
Format
Build to export to a single format
• Excel
• Word
• Web
• PDF
Then get buy-in and make it a standard in the organization
Demo: Build to export to excel
40. Lifehack: Keep notes daily on what you
do
Makes CVs easier
Makes reviews easier
Makes promotions easier
41. SSAS: Views are better than DSVs
• Easier to manage
• Can use SQL Search tools
• Can use SQL Dependency Tools
• Have a set of views only used by analysis services..so you
can change them without telling anyone else
42. SSRS: Used Linked Reports to Manage
Security
• Allows you to use Role assignments and
• Not have duplicate reports in folders
• Not have users in folders they shouldn’t be in
• Not manage security on individual reports
43. Management: Use Active Directory for
report security and cube security
User
Active Directory Group
Permission
One group – One Report
44. Management: Keep Report Quantity
Small
Too many reports means that there are more things to keep
consistent
Reports that aren’t used, tend to get forgotten, and then
used with bad data
46. Manage: Find the key person
• They know a lot
• They have time
• They respond quickly
• They are most often right
• They might not be
likeable, and that’s OK
• Success – Work in their
office
48. SSAS: Change one thing at a time
And break calculations down to their simplest form, deploy,
test, and change one more thing.
49. Manage: Very few KPIs and numbers!
""The well-intentioned desire to be great at everything is
precisely what leads to exhausted
mediocrity" https://www.youtube.com/watch?v=DWKvSG_
9s5I"
Walmart customer service
52. Data mart: Use friendly names
everywhere
Use spaces and long names
53. Manage: Use a wiki for taxonomy
Record owner
Record changes
Record technical calculation
54. Lifehack: Have the child call you
Whenever someone comes around saying "Would you like
to buy blah blah blah, my kid is going to do whatever."
I tell them, "Yes, I would love to! But your child has to be
the one to ask me." I then give them my number and say
the child can call anytime after 6pm.
69. Your feedback
is important
and valuable.
Submit by
11:59 PM PT,
April 30, 2015 to
WIN prizes
Session Evaluations
Go to
passbac2015/evals
Download the PASS
EVENT App from
your App Store and
search: PASS BAC
2015
Follow the QR code
link displayed on
session signage and
in the program
guide
update sales.customers
set contacttitle = null
where custid in ('59', '66', '78', '15')
use tsql2012
select * from sales.customers
select ContactName
+ ' - ' + ContactTitle
+ ', ' + City as GreetingLine
from sales.customers
select isnull(ContactName, '')
+ ' - ' + isnull(ContactTitle, '')
+ ', ' + isnull(City, '') as GreetingLine
from sales.customers
select concat(ContactName, ' ', ContactTitle, ' ', City) as GreetingLine
from sales.customers
use tsql2012
select *
from sales.orders
select custid, freight
from sales.orders
select custid, freight, sum(freight) as totalFreight
from sales.orders
select custid, sum(freight) as totalFreight
from sales.orders
group by custid
select custid, freight, sum(freight) as totalFreight
from sales.orders
group by custid
select custid, freight, sum(freight) as totalFreight
from sales.orders
group by custid, freight
--we're skipping subqueries, because they look ugly and
--it insults me aesthetically
;with FreightTotal
as
(
select custid, sum(freight) as totalFreight
from sales.orders
group by custid
)
select o.custid
, o.freight
, ft.totalFreight as totalFreight
from sales.orders o
join FreightTotal ft
on o.custid = ft.custid
--BIG IMPROVEMENT
--query can be executed independantly
--Can be reused, like this
;with FreightTotal
as
(
select custid, sum(freight) as totalFreight
from sales.orders
group by custid
)
select o.custid
, o.freight
, ft.totalFreight as totalFreight
, o.freight /ft.totalfreight * 100 as FreightPercentage
from sales.orders o
join FreightTotal ft
on o.custid = ft.custid
--but remember our original thought process
select custid, freight, sum(freight) as totalFreight
from sales.orders
--here's a windowing function
select custid
, freight
, sum(freight) over (partition by custid) as totalFreight
from sales.orders
--and reusing it is not that big of a deal
select custid
, freight
, sum(freight) over (partition by custid) as totalFreight
, freight / sum(freight) over (partition by custid) * 100 as FreightPercentage
from sales.orders
SELECT * FROM (SELECT urgency, name, phone, location, department, cc, status, case_manager, ip, case_manager_ei d, id_problem, id_problem_type, eid_author, title, body, date_created, date_modified FROM problems AS main INNER JOIN (SELECT id_problem as t_urgency_id_problem, node_value AS urgency FROM problem_nodes WHERE node_name = "urgency")t_urgency ON t_urgency.t_urgency_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_name_id_problem, node_value AS name FROM problem_nodes WHERE node_name = "name")t_name ON t_name.t_name_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_phone_id_problem, node_value AS phone FROM problem_nodes WHERE node_name = "phone")t_phone ON t_phone.t_phone_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_location_id_problem, node_value AS location FROM problem_nodes WHERE node_name = "location")t_location ON t_location.t_location_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_department_id_problem, node_value AS department FROM problem_nodes WHERE node_name = "department")t_department ON t_department.t_department_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_cc_id_problem, node_value AS cc FROM problem_nodes WHERE node_name = "cc")t_cc ON t_cc.t_cc_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_status_id_problem, node_value AS status FROM problem_nodes WHERE node_name = "status")t_status ON t_status.t_status_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_case_manager_id_problem, node_value AS case_manager FROM problem_nodes WHERE node_name = "case_manager")t_case_manager ON t_case_manager.t_case_manager_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_ip_id_problem, node_value AS ip FROM problem_nodes WHERE node_name = "ip")t_ip ON t_ip.t_ip_id_problem = main.id_problem INNER JOIN (SELECT id_problem as t_case_manager_eid_id_problem, node_value AS case_manager_eid FROM problem_nodes WHERE node_name = "case_manager_eid") t_case_manager_eid ON t_case_manager_eid.t_case_manager_eid_id_problem = main.id_problem)t
;with FirstMondays
as
(
Select DateAdd(day, (9-DatePart(weekday,
DateAdd(Month, 1+DateDiff(Month, 0, '12/1/2009'), 0)))%7,
DateAdd(Month, 1+DateDiff(Month, 0, '12/1/2009'), 0)) as FirstMonday
union all
select DateAdd(day, (9-DatePart(weekday,
DateAdd(Month, 1+DateDiff(Month, 0, FirstMonday), 0)))%7,
DateAdd(Month, 1+DateDiff(Month, 0, FirstMonday), 0))
from FirstMondays
where firstMonday <= '12/1/2010'
)
select * from FirstMondays
use adventureworksdw2012
select EnglishMonthName, min(datekey)
from dimdate
where englishdaynameofweek = 'monday'
and calendaryear = '2010'
group by EnglishMonthName, MonthNumberOfYear
order by MonthNumberOfYear
create table t1
(col1 varchar(100))
insert into t1
(col1)
values
('1')
,('2')
,('3')
,('ike')
,('1')
,('2')
,('3')
,('ike')
, ('1')
,('2')
,('3')
,('ike')
select cast(col1 as int) from t1
select try_cast(col1 as int) from t1
SELECT * FROM sales.Customers
WHERE custid = <custid, int, 0>
SELECT * FROM sales.customers c
JOIN sales.orders o
ON c.custid = o.custid
WHERE c.custid = <custid, int, 0>
AND o.orderdate > <orderdate, datetime, '1/1/2015'>