Presentation is loading. Please wait.

Presentation is loading. Please wait.

Brent Ozar SQL Server Expert Quest Software SESSION CODE: DAT316.

Similar presentations


Presentation on theme: "Brent Ozar SQL Server Expert Quest Software SESSION CODE: DAT316."— Presentation transcript:

1 Brent Ozar SQL Server Expert Quest Software SESSION CODE: DAT316

2

3

4

5

6

7

8

9 CREATE TRIGGER trig_addUser ON Users FOR INSERT AS DECLARE @newStatus VARCHAR(10) SELECT @newStatus = (SELECT StatusName FROM Inserted) IF @newStatus = 'INACTIVE' PRINT ‘Inactive employees can no longer be added.’ ROLLBACK

10

11 SELECT TOP 100 * FROM dbo.Posts WHERE OwnerUserId = 1538 SELECT TOP 100 Tags, Id FROM dbo.Posts WHERE OwnerUserId = 1538

12

13

14

15

16

17

18

19 DECLARE @string VARCHAR(100) SELECT @string = 'select * from authors' EXEC sp_executesql @string

20 DECLARE @string VARCHAR(100) SELECT @string = 'select * from authors’ + 'ORDER BY ' + @OrderBy EXEC sp_executesql @string

21

22

23

24

25

26

27

28 SELECT object_name(i.object_id ),p.rows,user_seeks,user_scans,user_lookups,user_updates,last_user_seek,last_user_scan,last_user_lookup FROM sys.indexes i INNER JOIN sys.partitions p ON i.object_id = p.object_id AND i.index_id = p.index_id LEFT OUTER JOIN sys.dm_db_index_usage_stats ius ON i.object_id = ius.object_id AND i.index_id = ius.index_id WHERE type_desc = 'HEAP' ORDER BY rows desc --http://www.brentozar.com/go/findheaps

29

30

31

32 Remove Indexes Add Indexes Observe

33

34

35

36

37

38

39

40

41

42 Required Slide Track PMs will supply the content for this slide, which will be inserted during the final scrub.

43 www.microsoft.com/teched www.microsoft.com/learning http://microsoft.com/technet http://microsoft.com/msdn

44

45 Sign up for Tech·Ed 2011 and save $500 starting June 8 – June 31 st http://northamerica.msteched.com/registration You can also register at the North America 2011 kiosk located at registration Join us in Atlanta next year

46


Download ppt "Brent Ozar SQL Server Expert Quest Software SESSION CODE: DAT316."

Similar presentations


Ads by Google