SlideShare a Scribd company logo
1 of 22
Sqlserver 2008 R2 Kashif Akram
New Datatypes Agenda  Datatypes CRL  Reporting Services
Datetime DATE: As you can imagine, the DATE data type only stores a date in the format of YYYY-MM-DD. It has a range of 0001-01-01 through 9999-12-32, which should be adequate for most business and scientific applications. The accuracy is 1 day, and it only takes 3 bytes to store the date. TIME: TIME is stored in the format: hh:mm:ss.nnnnnnn, with a range of 00:00:00.0000000 through 23:59:59:9999999 and is accurate to 100 nanoseconds. Storage depends on the precision and scale selected, and runs from 3 to 5 bytes.
DECLARE @d DATE   SET @d = GETDATE()   SELECT @d -- outputs '2008-04-06 '   SET @d = '1234-03-22 11:25:09'   SELECT @d  -- outputs '1234-03-22  '
CREATE TABLE #times(       T   TIME,       T1  TIME(1),       T5  TIME(5),       T7  TIME(7)       )   INSERT INTO #times VALUES (       '01:02:03.1234567',       '01:02:03.1234567',       '01:02:03.1234567',       '01:02:03.1234567')   SELECT * FROM #times   T                T1               T5               T7   ---------------- ---------------- ---------------- ----------------   01:02:03.1234567 01:02:03.1000000 01:02:03.1234600 01:02:03.1234567
DATETIME2: DATETIME2 is very similar to the older DATETIME data type, but has a greater range and precision. The format is YYYY-MM-DD hh:mm:ss:nnnnnnnm with a range of 0001-01-01 00:00:00.0000000 through 9999-12-31 23:59:59.9999999, and an accuracy of 100 nanoseconds. Storage depends on the precision and scale selected, and runs from 6 to 8 bytes. DATETIMEOFFSET: DATETIMEOFFSET is similar to DATETIME2, but includes additional information to track the time zone. The format is YYYY-MM-DD hh:mm:ss[.nnnnnnn] [+|-]hh:mm with a range of 0001-01-01 00:00:00.0000000 through 0001-01-01 00:00:00.0000000 through 9999-12-31 23:59:59.9999999 (in UTC), and an accuracy of 100 nanoseconds. Storage depends on the precision and scale selected, and runs from 8 to 10 bytes.
DECLARE @dateA DATETIME2 = '2008-04-05 01:02:03.12345'   PRINT @dateA -- outputs 2008-04-05 01:02:03.1234500   DECLARE @dateB DATETIME2(4) = '2008-04-05 01:02:03.12345'   PRINT @dateB -- outputs 2008-04-05 01:02:03.1235
DECLARE @today DATETIMEOFFSET = '2008-04-05T01:02:03.1234567-05:00'   PRINT @today -- outputs 2008-04-05 01:02:03.1234567 -05:00   DECLARE @today2 DATETIMEOFFSET(2) = '2008-04-05T01:02:03.1234567-05:00'   PRINT @today2 -- outputs 2008-04-05 01:02:03.12 -05:00
Spatial GEOMETRY: The GEOMETRY data type is used to store planar (flat-earth) data. It is generally used to store XY coordinates that represent points, lines, and polygons in a two-dimensional space. For example storing XY coordinates in the GEOMETRY data type can be used to map the exterior of a building. GEOGRAPHY: The GEOGRAPHY data type is used to store ellipsoidal (round-earth) data. It is used to store latitude and longitude coordinates that represent points, lines, and polygons on the earth’s surface. For example, GPS data that represents the lay of the land is one example of data that can be stored in theGEOGRAPHY data type.
DECLARE @shape geometry   SET @shape = geometry::STPolyFromText('POLYGON ((                    47.653 -122.358,                     47.653 -122.354,                     47.657 -122.354,                     47.653 -122.350,                     47.645 -122.350,                     ... (snip)                    47.651 -122.355,                     47.653 -122.358))',  0)
SELECT @shape.STEnvelope().ToString()   -- outputs something like   /*    POLYGON ((        47.657 -122.358,       47.657 -122.350,       47.645 -122.350,       47.645 -122.358,       47.657 -122.358))   */
HIERARCHYID Organizational structures A set of tasks that make up a larger projects (like a GANTT chart) File systems (folders and their sub-folders) A classification of language terms A bill of materials to assemble or build a product A graphical representation of links between web pages
CREATE TABLE #Categories (   CategoryID INT IDENTITY(1,1),   CategoryNode HIERARCHYID NOT NULL,   CategName NVARCHAR(40) NOT NULL       )
DECLARE @root HIERARCHYID = hierarchyid::GetRoot()   INSERT INTO #Categories (CategoryNode, CategName)        VALUES (@root, 'All #Categories')   -- insert the 'Electronics' category   DECLARE @electronics HIERARCHYID   SELECT @electronics = @root.GetDescendant(NULL, NULL)   INSERT INTO #Categories (CategoryNode, CategName)        VALUES (@electronics, 'Electronics')   -- insert the 'Music' category after 'Electronics'   DECLARE @music HIERARCHYID   SELECT @music = @root.GetDescendant(NULL, @electronics)   INSERT INTO #Categories (CategoryNode, CategName)        VALUES (@music, 'Music')
-- insert the 'Apparel' category between 'Electronics' and 'Music'   SELECT @music = @root.GetDescendant(@music, @electronics)   INSERT INTO #Categories (CategoryNode, CategName)        VALUES (@music, 'Apparel')   -- insert some children under 'Electronics'   DECLARE @video HIERARCHYID   --   We could do a simple @category.GetDescendant() but, let's   --      show something that is more likely to happen   SELECT @video = CategoryNode.GetDescendant(NULL, NULL)     FROM #Categories WHERE CategName ='Electronics'   INSERT INTO #Categories (CategoryNode, CategName)        VALUES (@video, 'Video Equipment')   -- insert some children under 'Video Equipment'   DECLARE @tvs HIERARCHYID   SELECT @tvs = @video.GetDescendant(NULL, NULL)   INSERT INTO #Categories (CategoryNode, CategName)        VALUES (@tvs, 'Televisions')   DECLARE @players HIERARCHYID   SELECT @players = @video.GetDescendant(NULL, @tvs)   INSERT INTO #Categories (CategoryNode, CategName)        VALUES (@players, 'DVD - BluRay')
SELECT    CategoryID, CategName,    CategoryNode,    CategoryNode.ToString() AS Path   FROM #Categories
FILESTREAM Transact-SQL can be used to SELECT, INSERT, UPDATE, DELETE FILESTREAM data. By default, FILESTREAM data is backed up and restored as part of the database file. If you want, there is an option available so you can backup a database without the FILESTREAM data. The size of the stored data is only limited by the available space of the file system. Standard VARBINARY(MAX) data is limited to 2 GB.
USE Production; GO CREATE TABLE DocumentStore ( DocumentID INT IDENTITY PRIMARY KEY,        Document VARBINARY (MAX) FILESTREAM NULL, DocGUID UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL               UNIQUE DEFAULT NEWID ()) FILESTREAM_ON FileStreamGroup1; GO
CLR EXEC sp_configure 'clr enabled', '1' reconfigure
Sqlserver 2008 r2
Sqlserver 2008 r2

More Related Content

What's hot

Cassandra model
Cassandra modelCassandra model
Cassandra modelzqhxuyuan
 
Grouping & Summarizing Data in R
Grouping & Summarizing Data in RGrouping & Summarizing Data in R
Grouping & Summarizing Data in RJeffrey Breen
 
Data Clustering with R
Data Clustering with RData Clustering with R
Data Clustering with RYanchang Zhao
 
Introduction to data.table in R
Introduction to data.table in RIntroduction to data.table in R
Introduction to data.table in RPaul Richards
 
Data manipulation with dplyr
Data manipulation with dplyrData manipulation with dplyr
Data manipulation with dplyrRomain Francois
 
3 pandasadvanced
3 pandasadvanced3 pandasadvanced
3 pandasadvancedpramod naik
 
Day 4a iteration and functions.pptx
Day 4a   iteration and functions.pptxDay 4a   iteration and functions.pptx
Day 4a iteration and functions.pptxAdrien Melquiond
 
Day 4b iteration and functions for-loops.pptx
Day 4b   iteration and functions  for-loops.pptxDay 4b   iteration and functions  for-loops.pptx
Day 4b iteration and functions for-loops.pptxAdrien Melquiond
 
Mysqlfunctions
MysqlfunctionsMysqlfunctions
MysqlfunctionsN13M
 
Big Data Mining in Indian Economic Survey 2017
Big Data Mining in Indian Economic Survey 2017Big Data Mining in Indian Economic Survey 2017
Big Data Mining in Indian Economic Survey 2017Parth Khare
 
Stata cheat sheet: data transformation
Stata  cheat sheet: data transformationStata  cheat sheet: data transformation
Stata cheat sheet: data transformationTim Essam
 
RDataMining slides-data-exploration-visualisation
RDataMining slides-data-exploration-visualisationRDataMining slides-data-exploration-visualisation
RDataMining slides-data-exploration-visualisationYanchang Zhao
 
11. Linear Models
11. Linear Models11. Linear Models
11. Linear ModelsFAO
 
Stata cheat sheet: data processing
Stata cheat sheet: data processingStata cheat sheet: data processing
Stata cheat sheet: data processingTim Essam
 

What's hot (20)

Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
Cassandra model
Cassandra modelCassandra model
Cassandra model
 
Grouping & Summarizing Data in R
Grouping & Summarizing Data in RGrouping & Summarizing Data in R
Grouping & Summarizing Data in R
 
Data Clustering with R
Data Clustering with RData Clustering with R
Data Clustering with R
 
Introduction to data.table in R
Introduction to data.table in RIntroduction to data.table in R
Introduction to data.table in R
 
Data manipulation with dplyr
Data manipulation with dplyrData manipulation with dplyr
Data manipulation with dplyr
 
3 pandasadvanced
3 pandasadvanced3 pandasadvanced
3 pandasadvanced
 
Sharbani bhattacharya sacta 2014
Sharbani bhattacharya sacta 2014Sharbani bhattacharya sacta 2014
Sharbani bhattacharya sacta 2014
 
Pemrograman Terstruktur 4
Pemrograman Terstruktur 4Pemrograman Terstruktur 4
Pemrograman Terstruktur 4
 
Day 4a iteration and functions.pptx
Day 4a   iteration and functions.pptxDay 4a   iteration and functions.pptx
Day 4a iteration and functions.pptx
 
Day 4b iteration and functions for-loops.pptx
Day 4b   iteration and functions  for-loops.pptxDay 4b   iteration and functions  for-loops.pptx
Day 4b iteration and functions for-loops.pptx
 
R gráfico
R gráficoR gráfico
R gráfico
 
Mysqlfunctions
MysqlfunctionsMysqlfunctions
Mysqlfunctions
 
Big Data Mining in Indian Economic Survey 2017
Big Data Mining in Indian Economic Survey 2017Big Data Mining in Indian Economic Survey 2017
Big Data Mining in Indian Economic Survey 2017
 
CLUSTERGRAM
CLUSTERGRAMCLUSTERGRAM
CLUSTERGRAM
 
Oracle sql ppt1
Oracle sql ppt1Oracle sql ppt1
Oracle sql ppt1
 
Stata cheat sheet: data transformation
Stata  cheat sheet: data transformationStata  cheat sheet: data transformation
Stata cheat sheet: data transformation
 
RDataMining slides-data-exploration-visualisation
RDataMining slides-data-exploration-visualisationRDataMining slides-data-exploration-visualisation
RDataMining slides-data-exploration-visualisation
 
11. Linear Models
11. Linear Models11. Linear Models
11. Linear Models
 
Stata cheat sheet: data processing
Stata cheat sheet: data processingStata cheat sheet: data processing
Stata cheat sheet: data processing
 

Similar to Sqlserver 2008 r2

Oracle to Cassandra Core Concepts Guide Pt. 2
Oracle to Cassandra Core Concepts Guide Pt. 2Oracle to Cassandra Core Concepts Guide Pt. 2
Oracle to Cassandra Core Concepts Guide Pt. 2DataStax Academy
 
What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?ukdpe
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 OverviewEric Nelson
 
New fordevelopersinsql server2008
New fordevelopersinsql server2008New fordevelopersinsql server2008
New fordevelopersinsql server2008Aaron Shilo
 
Non-Relational Postgres
Non-Relational PostgresNon-Relational Postgres
Non-Relational PostgresEDB
 
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...djkucera
 
Meetup cassandra for_java_cql
Meetup cassandra for_java_cqlMeetup cassandra for_java_cql
Meetup cassandra for_java_cqlzznate
 
Chris Mc Glothen Sql Portfolio
Chris Mc Glothen Sql PortfolioChris Mc Glothen Sql Portfolio
Chris Mc Glothen Sql Portfolioclmcglothen
 
Database Development Replication Security Maintenance Report
Database Development Replication Security Maintenance ReportDatabase Development Replication Security Maintenance Report
Database Development Replication Security Maintenance Reportnyin27
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisUniversity of Illinois,Chicago
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisUniversity of Illinois,Chicago
 
Data Exploration with Apache Drill: Day 1
Data Exploration with Apache Drill:  Day 1Data Exploration with Apache Drill:  Day 1
Data Exploration with Apache Drill: Day 1Charles Givre
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorialAxmed Mo.
 
Most useful queries
Most useful queriesMost useful queries
Most useful queriesSam Depp
 
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)Ontico
 
MariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB Server 10.3 - Temporale Daten und neues zur DB-KompatibilitätMariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB Server 10.3 - Temporale Daten und neues zur DB-KompatibilitätMariaDB plc
 

Similar to Sqlserver 2008 r2 (20)

Oracle to Cassandra Core Concepts Guide Pt. 2
Oracle to Cassandra Core Concepts Guide Pt. 2Oracle to Cassandra Core Concepts Guide Pt. 2
Oracle to Cassandra Core Concepts Guide Pt. 2
 
What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?What's New for Developers in SQL Server 2008?
What's New for Developers in SQL Server 2008?
 
SQL Server 2008 Overview
SQL Server 2008 OverviewSQL Server 2008 Overview
SQL Server 2008 Overview
 
New fordevelopersinsql server2008
New fordevelopersinsql server2008New fordevelopersinsql server2008
New fordevelopersinsql server2008
 
Non-Relational Postgres
Non-Relational PostgresNon-Relational Postgres
Non-Relational Postgres
 
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
Collaborate 2009 - Migrating a Data Warehouse from Microsoft SQL Server to Or...
 
Meetup cassandra for_java_cql
Meetup cassandra for_java_cqlMeetup cassandra for_java_cql
Meetup cassandra for_java_cql
 
Chris Mc Glothen Sql Portfolio
Chris Mc Glothen Sql PortfolioChris Mc Glothen Sql Portfolio
Chris Mc Glothen Sql Portfolio
 
Rdbms (2)
Rdbms (2)Rdbms (2)
Rdbms (2)
 
Database Development Replication Security Maintenance Report
Database Development Replication Security Maintenance ReportDatabase Development Replication Security Maintenance Report
Database Development Replication Security Maintenance Report
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency Analysis
 
Pumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency AnalysisPumps, Compressors and Turbine Fault Frequency Analysis
Pumps, Compressors and Turbine Fault Frequency Analysis
 
Data Exploration with Apache Drill: Day 1
Data Exploration with Apache Drill:  Day 1Data Exploration with Apache Drill:  Day 1
Data Exploration with Apache Drill: Day 1
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
Sql tutorial
Sql tutorialSql tutorial
Sql tutorial
 
Most useful queries
Most useful queriesMost useful queries
Most useful queries
 
SQL Windowing
SQL WindowingSQL Windowing
SQL Windowing
 
Full Text Search in PostgreSQL
Full Text Search in PostgreSQLFull Text Search in PostgreSQL
Full Text Search in PostgreSQL
 
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)
Полнотекстовый поиск в PostgreSQL / Александр Алексеев (Postgres Professional)
 
MariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB Server 10.3 - Temporale Daten und neues zur DB-KompatibilitätMariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
MariaDB Server 10.3 - Temporale Daten und neues zur DB-Kompatibilität
 

More from Kashif Akram

Sharepoint as a service platform
Sharepoint as a service platformSharepoint as a service platform
Sharepoint as a service platformKashif Akram
 
Sharepoint 2010 composites
Sharepoint 2010   compositesSharepoint 2010   composites
Sharepoint 2010 compositesKashif Akram
 
Microsoft Office Performance Point
Microsoft Office Performance PointMicrosoft Office Performance Point
Microsoft Office Performance PointKashif Akram
 
business data catalog - Sharepoint Portal Server 2007
business data catalog - Sharepoint Portal Server 2007business data catalog - Sharepoint Portal Server 2007
business data catalog - Sharepoint Portal Server 2007Kashif Akram
 
Introduction To Windows Workflow In Windows Share Point
Introduction To Windows Workflow In Windows Share PointIntroduction To Windows Workflow In Windows Share Point
Introduction To Windows Workflow In Windows Share PointKashif Akram
 
Connected Banking Framework
Connected Banking FrameworkConnected Banking Framework
Connected Banking FrameworkKashif Akram
 

More from Kashif Akram (8)

Windows azure
Windows azureWindows azure
Windows azure
 
Sharepoint as a service platform
Sharepoint as a service platformSharepoint as a service platform
Sharepoint as a service platform
 
Sharepoint 2010 composites
Sharepoint 2010   compositesSharepoint 2010   composites
Sharepoint 2010 composites
 
Microsoft Office Performance Point
Microsoft Office Performance PointMicrosoft Office Performance Point
Microsoft Office Performance Point
 
business data catalog - Sharepoint Portal Server 2007
business data catalog - Sharepoint Portal Server 2007business data catalog - Sharepoint Portal Server 2007
business data catalog - Sharepoint Portal Server 2007
 
Introduction To Windows Workflow In Windows Share Point
Introduction To Windows Workflow In Windows Share PointIntroduction To Windows Workflow In Windows Share Point
Introduction To Windows Workflow In Windows Share Point
 
Connected Banking Framework
Connected Banking FrameworkConnected Banking Framework
Connected Banking Framework
 
Vsts
VstsVsts
Vsts
 

Recently uploaded

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

Sqlserver 2008 r2

  • 1. Sqlserver 2008 R2 Kashif Akram
  • 2. New Datatypes Agenda Datatypes CRL Reporting Services
  • 3. Datetime DATE: As you can imagine, the DATE data type only stores a date in the format of YYYY-MM-DD. It has a range of 0001-01-01 through 9999-12-32, which should be adequate for most business and scientific applications. The accuracy is 1 day, and it only takes 3 bytes to store the date. TIME: TIME is stored in the format: hh:mm:ss.nnnnnnn, with a range of 00:00:00.0000000 through 23:59:59:9999999 and is accurate to 100 nanoseconds. Storage depends on the precision and scale selected, and runs from 3 to 5 bytes.
  • 4. DECLARE @d DATE SET @d = GETDATE() SELECT @d -- outputs '2008-04-06 ' SET @d = '1234-03-22 11:25:09' SELECT @d -- outputs '1234-03-22 '
  • 5. CREATE TABLE #times( T TIME, T1 TIME(1), T5 TIME(5), T7 TIME(7) ) INSERT INTO #times VALUES ( '01:02:03.1234567', '01:02:03.1234567', '01:02:03.1234567', '01:02:03.1234567') SELECT * FROM #times T T1 T5 T7 ---------------- ---------------- ---------------- ---------------- 01:02:03.1234567 01:02:03.1000000 01:02:03.1234600 01:02:03.1234567
  • 6. DATETIME2: DATETIME2 is very similar to the older DATETIME data type, but has a greater range and precision. The format is YYYY-MM-DD hh:mm:ss:nnnnnnnm with a range of 0001-01-01 00:00:00.0000000 through 9999-12-31 23:59:59.9999999, and an accuracy of 100 nanoseconds. Storage depends on the precision and scale selected, and runs from 6 to 8 bytes. DATETIMEOFFSET: DATETIMEOFFSET is similar to DATETIME2, but includes additional information to track the time zone. The format is YYYY-MM-DD hh:mm:ss[.nnnnnnn] [+|-]hh:mm with a range of 0001-01-01 00:00:00.0000000 through 0001-01-01 00:00:00.0000000 through 9999-12-31 23:59:59.9999999 (in UTC), and an accuracy of 100 nanoseconds. Storage depends on the precision and scale selected, and runs from 8 to 10 bytes.
  • 7. DECLARE @dateA DATETIME2 = '2008-04-05 01:02:03.12345' PRINT @dateA -- outputs 2008-04-05 01:02:03.1234500 DECLARE @dateB DATETIME2(4) = '2008-04-05 01:02:03.12345' PRINT @dateB -- outputs 2008-04-05 01:02:03.1235
  • 8. DECLARE @today DATETIMEOFFSET = '2008-04-05T01:02:03.1234567-05:00' PRINT @today -- outputs 2008-04-05 01:02:03.1234567 -05:00 DECLARE @today2 DATETIMEOFFSET(2) = '2008-04-05T01:02:03.1234567-05:00' PRINT @today2 -- outputs 2008-04-05 01:02:03.12 -05:00
  • 9. Spatial GEOMETRY: The GEOMETRY data type is used to store planar (flat-earth) data. It is generally used to store XY coordinates that represent points, lines, and polygons in a two-dimensional space. For example storing XY coordinates in the GEOMETRY data type can be used to map the exterior of a building. GEOGRAPHY: The GEOGRAPHY data type is used to store ellipsoidal (round-earth) data. It is used to store latitude and longitude coordinates that represent points, lines, and polygons on the earth’s surface. For example, GPS data that represents the lay of the land is one example of data that can be stored in theGEOGRAPHY data type.
  • 10. DECLARE @shape geometry SET @shape = geometry::STPolyFromText('POLYGON (( 47.653 -122.358, 47.653 -122.354, 47.657 -122.354, 47.653 -122.350, 47.645 -122.350, ... (snip) 47.651 -122.355, 47.653 -122.358))', 0)
  • 11. SELECT @shape.STEnvelope().ToString() -- outputs something like /* POLYGON (( 47.657 -122.358, 47.657 -122.350, 47.645 -122.350, 47.645 -122.358, 47.657 -122.358)) */
  • 12. HIERARCHYID Organizational structures A set of tasks that make up a larger projects (like a GANTT chart) File systems (folders and their sub-folders) A classification of language terms A bill of materials to assemble or build a product A graphical representation of links between web pages
  • 13. CREATE TABLE #Categories ( CategoryID INT IDENTITY(1,1), CategoryNode HIERARCHYID NOT NULL, CategName NVARCHAR(40) NOT NULL )
  • 14. DECLARE @root HIERARCHYID = hierarchyid::GetRoot() INSERT INTO #Categories (CategoryNode, CategName) VALUES (@root, 'All #Categories') -- insert the 'Electronics' category DECLARE @electronics HIERARCHYID SELECT @electronics = @root.GetDescendant(NULL, NULL) INSERT INTO #Categories (CategoryNode, CategName) VALUES (@electronics, 'Electronics') -- insert the 'Music' category after 'Electronics' DECLARE @music HIERARCHYID SELECT @music = @root.GetDescendant(NULL, @electronics) INSERT INTO #Categories (CategoryNode, CategName) VALUES (@music, 'Music')
  • 15. -- insert the 'Apparel' category between 'Electronics' and 'Music' SELECT @music = @root.GetDescendant(@music, @electronics) INSERT INTO #Categories (CategoryNode, CategName) VALUES (@music, 'Apparel') -- insert some children under 'Electronics' DECLARE @video HIERARCHYID -- We could do a simple @category.GetDescendant() but, let's -- show something that is more likely to happen SELECT @video = CategoryNode.GetDescendant(NULL, NULL) FROM #Categories WHERE CategName ='Electronics' INSERT INTO #Categories (CategoryNode, CategName) VALUES (@video, 'Video Equipment') -- insert some children under 'Video Equipment' DECLARE @tvs HIERARCHYID SELECT @tvs = @video.GetDescendant(NULL, NULL) INSERT INTO #Categories (CategoryNode, CategName) VALUES (@tvs, 'Televisions') DECLARE @players HIERARCHYID SELECT @players = @video.GetDescendant(NULL, @tvs) INSERT INTO #Categories (CategoryNode, CategName) VALUES (@players, 'DVD - BluRay')
  • 16. SELECT CategoryID, CategName, CategoryNode, CategoryNode.ToString() AS Path FROM #Categories
  • 17. FILESTREAM Transact-SQL can be used to SELECT, INSERT, UPDATE, DELETE FILESTREAM data. By default, FILESTREAM data is backed up and restored as part of the database file. If you want, there is an option available so you can backup a database without the FILESTREAM data. The size of the stored data is only limited by the available space of the file system. Standard VARBINARY(MAX) data is limited to 2 GB.
  • 18.
  • 19. USE Production; GO CREATE TABLE DocumentStore ( DocumentID INT IDENTITY PRIMARY KEY, Document VARBINARY (MAX) FILESTREAM NULL, DocGUID UNIQUEIDENTIFIER NOT NULL ROWGUIDCOL UNIQUE DEFAULT NEWID ()) FILESTREAM_ON FileStreamGroup1; GO
  • 20. CLR EXEC sp_configure 'clr enabled', '1' reconfigure