{"id":587,"date":"2024-07-29T19:20:39","date_gmt":"2024-07-29T19:20:39","guid":{"rendered":"https:\/\/datacrazyworld.com\/?p=587"},"modified":"2024-07-29T19:20:42","modified_gmt":"2024-07-29T19:20:42","slug":"date_bucket-y-datetrunc","status":"publish","type":"post","link":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/","title":{"rendered":"DATE_BUCKET y DATETRUNC"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">La \u00faltima versi\u00f3n del SQL Server, la 2022, trae consigo muchas novedades y hoy os vengo a hablar de un par de nuevas funciones de fechas que que me ha sorprendido porque viene a agilizar mucho las consultas basadas en fechas: <strong><em>DATE_BUCKET <\/em><\/strong>y <strong><em>DATETRUNC<\/em><\/strong>. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Empecemos conociendo el <strong>DATETRUNC<\/strong> que para mi es la m\u00e1s sencilla de entender. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Su sintaxis es: <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DATETRUNC (datepart, fecha)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Esta funci\u00f3n devuelve la <em>fecha de entrada<\/em> seg\u00fan el <em>datepart <\/em>indicado. Es decir, por ejemplo, si indicas <em>year <\/em>te devolver\u00e1 el 1 de Enero de ese a\u00f1o o si indicas <em>month<\/em>, el 1 del m\u00e9s.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1017\" height=\"445\" src=\"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image.png\" alt=\"\" class=\"wp-image-589\" style=\"width:592px;height:auto\" srcset=\"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image.png 1017w, https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-300x131.png 300w, https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-768x336.png 768w\" sizes=\"auto, (max-width: 1017px) 100vw, 1017px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Est\u00e1 muy bien porque acepta como tipo de dato de la entrada diferentes precisiones de fechas, respet\u00e1ndola en la salida, e incluso acepta que le pases una cadena literal, siempre que pueda resolverse como tipo <em>datetime2(7)<\/em>.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"883\" height=\"483\" src=\"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-1.png\" alt=\"\" class=\"wp-image-590\" style=\"width:600px;height:auto\" srcset=\"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-1.png 883w, https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-1-300x164.png 300w, https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-1-768x420.png 768w\" sizes=\"auto, (max-width: 883px) 100vw, 883px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">El <strong>DATE_BUCKET <\/strong>en cierto modo es muy parecido a esta funci\u00f3n, pero como veremos tiene alg\u00fan matiz diferente.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Su sintaxis es:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DATE_BUCKET (datepart, numero, fecha&#91;, origen] )<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">La definici\u00f3n que hace Microsoft sobre esta funci\u00f3n es:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"><em>Esta funci\u00f3n devuelve el valor de fecha y hora correspondiente al inicio de cada cubo de fecha y hora, desde la marca de tiempo definida por el par\u00e1metro\u00a0<code>origen<\/code>\u00a0o el valor de origen predeterminado de\u00a0<code>1900-01-01 00:00:00.000<\/code>, si el par\u00e1metro de origen no se ha especificado.<\/em><\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\">A mi me con esta definici\u00f3n, la verdad es que me cost\u00f3 entender qu\u00e9 hac\u00eda realmente y hasta que no empec\u00e9 a hacer pruebas no lo entend\u00ed. A ver si consigo definirlo de forma que lo entend\u00e1is. El <em>DATE_BUCKET <\/em>devuelve lo mismo que el <em>DATETRUNC <\/em>si pusi\u00e9ramos el par\u00e1metro <em>numero <\/em>a 1. Es decir, devuelve una fecha de inicio seg\u00fan el <em>datepart <\/em>indicado, s\u00f3lo que adaptando al <em>numero <\/em>de unidades indicado.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"391\" src=\"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-2-1024x391.png\" alt=\"\" class=\"wp-image-591\" style=\"width:737px;height:auto\" srcset=\"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-2-1024x391.png 1024w, https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-2-300x115.png 300w, https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-2-768x293.png 768w, https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-2.png 1424w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Veamos qu\u00e9 ocurre si en vez de un 1, ponemos un 5.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"392\" src=\"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-3-1024x392.png\" alt=\"\" class=\"wp-image-592\" style=\"width:739px;height:auto\" srcset=\"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-3-1024x392.png 1024w, https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-3-300x115.png 300w, https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-3-768x294.png 768w, https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-3.png 1420w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">El resultado es que nos agrupa en bloques de 5 unidades de tiempo. Esto nos permite, por ejemplo, hacer consultas en las que podemos agrupar los registros por bloques de 5 minutos, por d\u00edas o meses. De esta forma se simplifican mucho las consultas de este estilo<\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"980\" height=\"803\" src=\"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-4.png\" alt=\"\" class=\"wp-image-593\" style=\"width:571px;height:auto\" srcset=\"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-4.png 980w, https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-4-300x246.png 300w, https:\/\/datacrazyworld.com\/wp-content\/uploads\/2024\/07\/image-4-768x629.png 768w\" sizes=\"auto, (max-width: 980px) 100vw, 980px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Como indicaba anteriormente con esta funci\u00f3n ahora es mucho m\u00e1s sencillo. Antes, para hacer esto mismo ten\u00edamos que jugar con el <em>Datepart <\/em> pero solo sacaba a\u00f1o, mes o d\u00eda cada vez y si quer\u00edamos m\u00e1s cosas juntas, hab\u00eda que concatenar columnas.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Aqu\u00ed os dejo los links a la documentaci\u00f3n de Microsoft, para que la le\u00e1is en detalle y sobre todo os fij\u00e9is en los ejemplo.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/learn.microsoft.com\/es-es\/sql\/t-sql\/functions\/datetrunc-transact-sql?view=sql-server-ver16\" target=\"_blank\" rel=\"noopener\" title=\"\">DATETRUNC<\/a><\/li>\n\n\n\n<li><a href=\"https:\/\/learn.microsoft.com\/es-es\/sql\/t-sql\/functions\/date-bucket-transact-sql?view=sql-server-ver16\" target=\"_blank\" rel=\"noopener\" title=\"\">DATE_BUCKET<\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">No se si os pasar\u00e1 como a m\u00ed, que a pesar de que cuando sale una versi\u00f3n nueva os le\u00e9is las novedades, siempre pasa desapercibido algo que de repente alg\u00fan compa\u00f1ero os descubre y a partir de ese momento no pod\u00e9is vivir sin ello. Para m\u00ed este ha sido uno de esos casos y por eso lo he querido compartir con vosotros. \u00a1Espero que os sea de utilidad! <\/p>\n","protected":false},"excerpt":{"rendered":"<p>En esta nueva T-SQL Pill te hablo de dos nuevas funciones de fechas incorporadas en SQL Server 2022 que no te puedes perder.<\/p>\n","protected":false},"author":2,"featured_media":316,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"footnotes":""},"categories":[8,9],"tags":[21,12],"class_list":["post-587","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-sqlserver","category-tsql","tag-sqlserver","tag-tsql"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.10 - aioseo.com -->\n\t<meta name=\"description\" content=\"En esta nueva T-SQL Pill te hablo de dos nuevas funciones de fechas incorporadas en SQL Server 2022 que no te puedes perder.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Cristina Tarabini-Castellani Ciordia\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.10\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@DataCrazyWorld\" \/>\n\t\t<meta name=\"twitter:title\" content=\"DATE_BUCKET y DATETRUNC - Data Crazy World\" \/>\n\t\t<meta name=\"twitter:description\" content=\"En esta nueva T-SQL Pill te hablo de dos nuevas funciones de fechas incorporadas en SQL Server 2022 que no te puedes perder.\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@DataCrazyWorld\" \/>\n\t\t<meta name=\"twitter:image\" content=\"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2022\/12\/Color_Small.png\" \/>\n\t\t<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t\t<meta name=\"twitter:data1\" content=\"Cristina Tarabini-Castellani Ciordia\" \/>\n\t\t<meta name=\"twitter:label2\" content=\"Tiempo de lectura estimado\" \/>\n\t\t<meta name=\"twitter:data2\" content=\"3 minutos\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/#blogposting\",\"name\":\"DATE_BUCKET y DATETRUNC - Data Crazy World\",\"headline\":\"DATE_BUCKET y DATETRUNC\",\"author\":{\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/author\\\/tarabiquetevi\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/datacrazyworld.com\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/TSQLPill.png\",\"width\":1200,\"height\":630,\"caption\":\"T-SQL Pill\"},\"datePublished\":\"2024-07-29T19:20:39+00:00\",\"dateModified\":\"2024-07-29T19:20:42+00:00\",\"inLanguage\":\"es-ES\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/#webpage\"},\"articleSection\":\"SQL Server, tsql, sqlserver, tsql\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/datacrazyworld.com#listItem\",\"position\":1,\"name\":\"Inicio\",\"item\":\"https:\\\/\\\/datacrazyworld.com\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/category\\\/sqlserver\\\/#listItem\",\"name\":\"SQL Server\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/category\\\/sqlserver\\\/#listItem\",\"position\":2,\"name\":\"SQL Server\",\"item\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/category\\\/sqlserver\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/category\\\/sqlserver\\\/tsql\\\/#listItem\",\"name\":\"tsql\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/datacrazyworld.com#listItem\",\"name\":\"Inicio\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/category\\\/sqlserver\\\/tsql\\\/#listItem\",\"position\":3,\"name\":\"tsql\",\"item\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/category\\\/sqlserver\\\/tsql\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/#listItem\",\"name\":\"DATE_BUCKET y DATETRUNC\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/category\\\/sqlserver\\\/#listItem\",\"name\":\"SQL Server\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/#listItem\",\"position\":4,\"name\":\"DATE_BUCKET y DATETRUNC\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/category\\\/sqlserver\\\/tsql\\\/#listItem\",\"name\":\"tsql\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/#person\",\"name\":\"Cristina Tarabini-Castellani Ciordia\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/020df7a271c91fd52178caf747ffe0997d2f1113e00f58e77a2878622e27453f?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Cristina Tarabini-Castellani Ciordia\"},\"sameAs\":[\"https:\\\/\\\/twitter.com\\\/DataCrazyWorld\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/cristina-tarabini-castellani\\\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/author\\\/tarabiquetevi\\\/#author\",\"url\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/author\\\/tarabiquetevi\\\/\",\"name\":\"Cristina Tarabini-Castellani Ciordia\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/020df7a271c91fd52178caf747ffe0997d2f1113e00f58e77a2878622e27453f?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Cristina Tarabini-Castellani Ciordia\"},\"sameAs\":[\"https:\\\/\\\/twitter.com\\\/DataCrazyWorld\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/cristina-tarabini-castellani\\\/\"]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/#webpage\",\"url\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/\",\"name\":\"DATE_BUCKET y DATETRUNC - Data Crazy World\",\"description\":\"En esta nueva T-SQL Pill te hablo de dos nuevas funciones de fechas incorporadas en SQL Server 2022 que no te puedes perder.\",\"inLanguage\":\"es-ES\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/author\\\/tarabiquetevi\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/author\\\/tarabiquetevi\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/datacrazyworld.com\\\/wp-content\\\/uploads\\\/2023\\\/10\\\/TSQLPill.png\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/#mainImage\",\"width\":1200,\"height\":630,\"caption\":\"T-SQL Pill\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/index.php\\\/2024\\\/07\\\/29\\\/date_bucket-y-datetrunc\\\/#mainImage\"},\"datePublished\":\"2024-07-29T19:20:39+00:00\",\"dateModified\":\"2024-07-29T19:20:42+00:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/#website\",\"url\":\"https:\\\/\\\/datacrazyworld.com\\\/\",\"name\":\"DataCrazyWorld\",\"description\":\"SQL Server, PowerShell, Power BI, Power Platform,... Los datos, ese mundo tan interesante, variado, divertido y ... \\u00a1Loco!\",\"inLanguage\":\"es-ES\",\"publisher\":{\"@id\":\"https:\\\/\\\/datacrazyworld.com\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"DATE_BUCKET y DATETRUNC - Data Crazy World","description":"En esta nueva T-SQL Pill te hablo de dos nuevas funciones de fechas incorporadas en SQL Server 2022 que no te puedes perder.","canonical_url":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/#blogposting","name":"DATE_BUCKET y DATETRUNC - Data Crazy World","headline":"DATE_BUCKET y DATETRUNC","author":{"@id":"https:\/\/datacrazyworld.com\/index.php\/author\/tarabiquetevi\/#author"},"publisher":{"@id":"https:\/\/datacrazyworld.com\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2023\/10\/TSQLPill.png","width":1200,"height":630,"caption":"T-SQL Pill"},"datePublished":"2024-07-29T19:20:39+00:00","dateModified":"2024-07-29T19:20:42+00:00","inLanguage":"es-ES","mainEntityOfPage":{"@id":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/#webpage"},"isPartOf":{"@id":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/#webpage"},"articleSection":"SQL Server, tsql, sqlserver, tsql"},{"@type":"BreadcrumbList","@id":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/datacrazyworld.com#listItem","position":1,"name":"Inicio","item":"https:\/\/datacrazyworld.com","nextItem":{"@type":"ListItem","@id":"https:\/\/datacrazyworld.com\/index.php\/category\/sqlserver\/#listItem","name":"SQL Server"}},{"@type":"ListItem","@id":"https:\/\/datacrazyworld.com\/index.php\/category\/sqlserver\/#listItem","position":2,"name":"SQL Server","item":"https:\/\/datacrazyworld.com\/index.php\/category\/sqlserver\/","nextItem":{"@type":"ListItem","@id":"https:\/\/datacrazyworld.com\/index.php\/category\/sqlserver\/tsql\/#listItem","name":"tsql"},"previousItem":{"@type":"ListItem","@id":"https:\/\/datacrazyworld.com#listItem","name":"Inicio"}},{"@type":"ListItem","@id":"https:\/\/datacrazyworld.com\/index.php\/category\/sqlserver\/tsql\/#listItem","position":3,"name":"tsql","item":"https:\/\/datacrazyworld.com\/index.php\/category\/sqlserver\/tsql\/","nextItem":{"@type":"ListItem","@id":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/#listItem","name":"DATE_BUCKET y DATETRUNC"},"previousItem":{"@type":"ListItem","@id":"https:\/\/datacrazyworld.com\/index.php\/category\/sqlserver\/#listItem","name":"SQL Server"}},{"@type":"ListItem","@id":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/#listItem","position":4,"name":"DATE_BUCKET y DATETRUNC","previousItem":{"@type":"ListItem","@id":"https:\/\/datacrazyworld.com\/index.php\/category\/sqlserver\/tsql\/#listItem","name":"tsql"}}]},{"@type":"Person","@id":"https:\/\/datacrazyworld.com\/#person","name":"Cristina Tarabini-Castellani Ciordia","image":{"@type":"ImageObject","@id":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/020df7a271c91fd52178caf747ffe0997d2f1113e00f58e77a2878622e27453f?s=96&d=mm&r=g","width":96,"height":96,"caption":"Cristina Tarabini-Castellani Ciordia"},"sameAs":["https:\/\/twitter.com\/DataCrazyWorld","https:\/\/www.linkedin.com\/in\/cristina-tarabini-castellani\/"]},{"@type":"Person","@id":"https:\/\/datacrazyworld.com\/index.php\/author\/tarabiquetevi\/#author","url":"https:\/\/datacrazyworld.com\/index.php\/author\/tarabiquetevi\/","name":"Cristina Tarabini-Castellani Ciordia","image":{"@type":"ImageObject","@id":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/020df7a271c91fd52178caf747ffe0997d2f1113e00f58e77a2878622e27453f?s=96&d=mm&r=g","width":96,"height":96,"caption":"Cristina Tarabini-Castellani Ciordia"},"sameAs":["https:\/\/twitter.com\/DataCrazyWorld","https:\/\/www.linkedin.com\/in\/cristina-tarabini-castellani\/"]},{"@type":"WebPage","@id":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/#webpage","url":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/","name":"DATE_BUCKET y DATETRUNC - Data Crazy World","description":"En esta nueva T-SQL Pill te hablo de dos nuevas funciones de fechas incorporadas en SQL Server 2022 que no te puedes perder.","inLanguage":"es-ES","isPartOf":{"@id":"https:\/\/datacrazyworld.com\/#website"},"breadcrumb":{"@id":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/#breadcrumblist"},"author":{"@id":"https:\/\/datacrazyworld.com\/index.php\/author\/tarabiquetevi\/#author"},"creator":{"@id":"https:\/\/datacrazyworld.com\/index.php\/author\/tarabiquetevi\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2023\/10\/TSQLPill.png","@id":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/#mainImage","width":1200,"height":630,"caption":"T-SQL Pill"},"primaryImageOfPage":{"@id":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/#mainImage"},"datePublished":"2024-07-29T19:20:39+00:00","dateModified":"2024-07-29T19:20:42+00:00"},{"@type":"WebSite","@id":"https:\/\/datacrazyworld.com\/#website","url":"https:\/\/datacrazyworld.com\/","name":"DataCrazyWorld","description":"SQL Server, PowerShell, Power BI, Power Platform,... Los datos, ese mundo tan interesante, variado, divertido y ... \u00a1Loco!","inLanguage":"es-ES","publisher":{"@id":"https:\/\/datacrazyworld.com\/#person"}}]},"twitter:card":"summary_large_image","twitter:site":"@DataCrazyWorld","twitter:title":"DATE_BUCKET y DATETRUNC - Data Crazy World","twitter:description":"En esta nueva T-SQL Pill te hablo de dos nuevas funciones de fechas incorporadas en SQL Server 2022 que no te puedes perder.","twitter:creator":"@DataCrazyWorld","twitter:image":"https:\/\/datacrazyworld.com\/wp-content\/uploads\/2022\/12\/Color_Small.png","twitter:label1":"Escrito por","twitter:data1":"Cristina Tarabini-Castellani Ciordia","twitter:label2":"Tiempo de lectura estimado","twitter:data2":"3 minutos"},"aioseo_meta_data":{"post_id":"587","title":null,"description":null,"keywords":null,"keyphrases":{"focus":{"keyphrase":"","score":0,"analysis":{"keyphraseInTitle":{"score":0,"maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"BlogPosting","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2024-07-15 18:22:45","updated":"2025-06-04 03:50:37","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/datacrazyworld.com\" title=\"Inicio\">Inicio<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/datacrazyworld.com\/index.php\/category\/sqlserver\/\" title=\"SQL Server\">SQL Server<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/datacrazyworld.com\/index.php\/category\/sqlserver\/tsql\/\" title=\"tsql\">tsql<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tDATE_BUCKET y DATETRUNC\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Inicio","link":"https:\/\/datacrazyworld.com"},{"label":"SQL Server","link":"https:\/\/datacrazyworld.com\/index.php\/category\/sqlserver\/"},{"label":"tsql","link":"https:\/\/datacrazyworld.com\/index.php\/category\/sqlserver\/tsql\/"},{"label":"DATE_BUCKET y DATETRUNC","link":"https:\/\/datacrazyworld.com\/index.php\/2024\/07\/29\/date_bucket-y-datetrunc\/"}],"_links":{"self":[{"href":"https:\/\/datacrazyworld.com\/index.php\/wp-json\/wp\/v2\/posts\/587","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/datacrazyworld.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/datacrazyworld.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/datacrazyworld.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/datacrazyworld.com\/index.php\/wp-json\/wp\/v2\/comments?post=587"}],"version-history":[{"count":7,"href":"https:\/\/datacrazyworld.com\/index.php\/wp-json\/wp\/v2\/posts\/587\/revisions"}],"predecessor-version":[{"id":599,"href":"https:\/\/datacrazyworld.com\/index.php\/wp-json\/wp\/v2\/posts\/587\/revisions\/599"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/datacrazyworld.com\/index.php\/wp-json\/wp\/v2\/media\/316"}],"wp:attachment":[{"href":"https:\/\/datacrazyworld.com\/index.php\/wp-json\/wp\/v2\/media?parent=587"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/datacrazyworld.com\/index.php\/wp-json\/wp\/v2\/categories?post=587"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/datacrazyworld.com\/index.php\/wp-json\/wp\/v2\/tags?post=587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}