I wish i knew that yesterday!
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

I wish i knew that yesterday!

on

  • 472 views

 

Statistics

Views

Total Views
472
Views on SlideShare
472
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment
  • A sequence is a user-defined schema bound object that generates a sequence of numeric values.NOT LIKE IDENTITY INSERTS – Don’t need to insert a row to get the next value.You can either use to insert identity values into a table (or multiple tables) or you can also use it in some T-SQL script, since it is an object.Incredibly useful for partition switching
  • A sequence is a user-defined schema bound object that generates a sequence of numeric values.NOT LIKE IDENTITY INSERTS – Don’t need to insert a row to get the next value.You can either use to insert identity values into a table (or multiple tables) or you can also use it in some T-SQL script, since it is an object.Incredibly useful for partition switching
  • Paging is one of the most used patterns in application dev.It’s also the one that tends to get borked the most. SQL Server 2012 introduces a few new things to help out in this regard.
  • The OFFSET-FETCH clause provides you with an option to fetch only a window or page of results from the result set.There are some limitations with offset & fetch
  • The DATEFROMPARTS function, returns a date value with the date part set to the specified year, specified month and the specified day, and the time portion set to the default.The DATETIMEFROMPARTS function, returns full datetime value with the date time part set to the specified year, specified month, specified day, specified hour, specified minute, specified second and the specified milliseconds.The DATETIME2FROMPARTS function, returns full datetime2 value with the date time part set to the specified year, specified month, specified day, specified hour, specified minute, specified second and the specified precision.The SMALLDATETIMEFROMPARTS function, returns full datetime value with the date time part set to the specified year, specified month, specified day, specified hour and the specified minute.The DATETIMEOFFSETFROMPARTS function returns a full datetimeoffset. The OFFSET argument is basically used to represent the time zone offset value hour and minutes.
  • FORMAT(), expects at three parameters,Value – Expression of a supported data type to format.Format – nvarchar format pattern.Culture – Optional nvarchar argument specifying a culture.“If the culture argument is not provided, then the language of the current session is used. This language is set either implicitly, or explicitly by using the SET LANGUAGE statement. culture accepts any culture supported by the .NET Framework as an argument; it is not limited to the languages explicitly supported by SQL Server . If the culture argument is not valid, FORMAT raises an error.”DEMO
  • PARSEAttempts to parse a string and convert it to a specified datatype.Can only convert to a number or datetimeUses the .Net CLRTRY_PARSE()Like PARSE but returns a NULL if the PARSE failsstill uses .NETCLRTRY_CONVERTAttempts to cast a value into a specified data type. Returns NULL if CONVERT fails.

I wish i knew that yesterday! Presentation Transcript

  • 1. I wish I knew that yesterday! SQL Server 2012 Awesomeness and some other stuff
  • 2. Matt Horn • Senior Consultant – Aphelion Software • Microsoft® Certified Technology Specialist • Co-lead JHB Business Intelligence Developer Network • Lead - IntelliCape B.I. User Group 9/27/2013 | Managing role based security with SharePoint2 |
  • 3. Agenda  Sequences  Paging  Dates  String Functions  Conversion Functions  Other useful @#$% 9/27/2013 | Footer Goes Here3 |
  • 4. Sequences
  • 5. Sequences  Used to generate numeric sequences.  Set min and max values  Caching of future values minimizing disk IO. 0/
  • 6. Paging
  • 7. OFFSET & FETCH  ORDER BY is mandatory  OFFSET and FETCH are a pair.  TOP is a no no.
  • 8. Dates
  • 9. New Functions  DATEFROMPARTS  DATETIMEFROMPARTS  DATETIME2FROMPARTS  SMALLDATETIMEFROMPARTS  DATETIMEOFFSETFROMPARTS  TIMEFROMPARTS  EOMONTH
  • 10. Strings
  • 11. String Functions  CONCAT  Does what it says on the box  FORMAT  Looks simple. MASSIVELY useful
  • 12. Conversion Functions  PARSE  TRY_PARSE  TRY_CONVERT
  • 13. Other useful .. stuff