{"id":8848,"date":"2025-12-06T22:10:55","date_gmt":"2025-12-06T22:10:55","guid":{"rendered":"https:\/\/resizemyimg.com\/blog\/?p=8848"},"modified":"2025-12-06T22:20:36","modified_gmt":"2025-12-06T22:20:36","slug":"sql-cast-converting-data-types-in-queries","status":"publish","type":"post","link":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/","title":{"rendered":"SQL cast: Converting Data Types in Queries"},"content":{"rendered":"<p>Ever tried adding a date to a number in SQL? Or comparing a string to an integer? If you have, chances are you hit an error or got strange results. That\u2019s because SQL is strict about data types. Enter the magical tool: <i>CAST<\/i>. It lets you convert data from one type to another\u2014safely and smartly.<\/p>\n<h2>TL;DR Summary<\/h2>\n<p>\nWhen working with SQL, sometimes your data types don\u2019t match. That\u2019s where <b>CAST<\/b> and <b>CONVERT<\/b> come in. They help change one data type to another so your queries work better. Use them when combining, comparing, or displaying data in different formats. It makes your queries more flexible and powerful.\n<\/p>\n<hr>\n<h2>What Is SQL CAST?<\/h2>\n<p><b>CAST<\/b> is a SQL function that changes the data type of a value.<\/p>\n<p>Say you have a text value like &#8220;123&#8221;, but you want it to behave like a number. You can use CAST to turn that string into an integer.<\/p>\n<p>The basic syntax looks like this:<\/p>\n<pre><code>\nCAST(expression AS target_data_type)\n<\/code><\/pre>\n<p>And here\u2019s a quick example:<\/p>\n<pre><code>\nSELECT CAST('123' AS INT) AS converted_number;\n<\/code><\/pre>\n<p>This takes the string &#8216;123&#8217; and converts it into an integer, so you can do math with it.<\/p>\n<h2>Why Would You Use CAST?<\/h2>\n<p>Good question! Here are some common reasons:<\/p>\n<ul>\n<li><b>Combine Different Data Types<\/b>: For example, adding a number to a string version of a number.<\/li>\n<li><b>Format Output<\/b>: Like turning a float into a string for neat reports.<\/li>\n<li><b>Fix Errors<\/b>: Prevent type mismatch errors in joins or comparisons.<\/li>\n<\/ul>\n<p>Let\u2019s see it in real life.<\/p>\n<pre><code>\nSELECT 'The price is ' + CAST(price AS VARCHAR)\nFROM products;\n<\/code><\/pre>\n<p>In this case, the number (price) is converted to text so it can be joined with other text.<\/p>\n<img loading=\"lazy\" decoding=\"async\" width=\"1080\" height=\"720\" src=\"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/computer-screen-showing-lines-of-code-sql-query-cast-function-convert-data-types.jpg\" class=\"attachment-full size-full\" alt=\"\" srcset=\"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/computer-screen-showing-lines-of-code-sql-query-cast-function-convert-data-types.jpg 1080w, https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/computer-screen-showing-lines-of-code-sql-query-cast-function-convert-data-types-300x200.jpg 300w, https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/computer-screen-showing-lines-of-code-sql-query-cast-function-convert-data-types-1024x683.jpg 1024w, https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/computer-screen-showing-lines-of-code-sql-query-cast-function-convert-data-types-575x383.jpg 575w, https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/computer-screen-showing-lines-of-code-sql-query-cast-function-convert-data-types-768x512.jpg 768w\" sizes=\"(max-width: 1080px) 100vw, 1080px\" \/>\n<h2>CAST vs CONVERT<\/h2>\n<p>SQL gives you <i>two<\/i> functions to change data types: <b>CAST<\/b> and <b>CONVERT<\/b>.<\/p>\n<p>Both do similar things, but here\u2019s how they differ:<\/p>\n<ul>\n<li><b>CAST<\/b> is a standard SQL function. It works the same across different database systems.<\/li>\n<li><b>CONVERT<\/b> is Microsoft SQL Server-specific and gives you more options for formatting dates and numbers.<\/li>\n<\/ul>\n<p>Here\u2019s an example of CONVERT:<\/p>\n<pre><code>\nSELECT CONVERT(VARCHAR, GETDATE(), 101) AS formatted_date;\n<\/code><\/pre>\n<p>This converts the current date into a MM\/DD\/YYYY format. Pretty cool, right?<\/p>\n<h2>Common Data Type Conversions<\/h2>\n<p>Here are the usual suspects when it comes to conversion:<\/p>\n<ul>\n<li><b>String to Integer:<\/b> CAST(&#8216;789&#8217; AS INT)<\/li>\n<li><b>Integer to String:<\/b> CAST(789 AS VARCHAR)<\/li>\n<li><b>Date to String:<\/b> CAST(GETDATE() AS VARCHAR)<\/li>\n<li><b>Float to Integer:<\/b> CAST(123.45 AS INT)<\/li>\n<\/ul>\n<p>Be aware: when you convert from float to int, you lose the decimals!<\/p>\n<pre><code>\nSELECT CAST(123.99 AS INT) AS result;\n-- Output: 123 (not 124)\n<\/code><\/pre>\n<p>SQL just chops off the decimal. It doesn\u2019t round it. So be careful!<\/p>\n<h2>Using CAST in Math<\/h2>\n<p>Imagine you&#8217;re doing division and both numbers are integers. SQL will return an integer result\u2014no decimals!<\/p>\n<pre><code>\nSELECT 10 \/ 4 AS result;\n-- Output: 2\n<\/code><\/pre>\n<p>Oops! Where\u2019s the 0.5? You\u2019ve lost it because integers were used.<\/p>\n<p>Let\u2019s fix it with CAST:<\/p>\n<pre><code>\nSELECT CAST(10 AS FLOAT) \/ 4 AS result;\n-- Output: 2.5\n<\/code><\/pre>\n<p>Much better.<\/p>\n<h2>CAST in WHERE Clauses<\/h2>\n<p>You can also use CAST in <b>WHERE<\/b> clauses to help filter data.<\/p>\n<pre><code>\nSELECT *\nFROM orders\nWHERE CAST(order_date AS DATE) = '2024-01-01';\n<\/code><\/pre>\n<p>This helps if <code>order_date<\/code> is actually a datetime and you only care about the date part.<\/p>\n<p>Combining CAST with filters = powerful stuff!<\/p>\n<h2>Nested CASTs<\/h2>\n<p>Can you convert something, then convert it again? Absolutely.<\/p>\n<pre><code>\nSELECT CAST(CAST(price AS FLOAT) AS VARCHAR)\nFROM products;\n<\/code><\/pre>\n<p>This takes a number, turns it into a float, and then into text. It\u2019s a \u201cconversion sandwich\u201d!<\/p>\n<h2>When Not to Use CAST<\/h2>\n<p>Sometimes, casting is not the best idea. Be cautious when:<\/p>\n<ul>\n<li><b>You Could Lose Data<\/b>: Converting float to int removes decimals.<\/li>\n<li><b>The Format Doesn\u2019t Match<\/b>: Converting &#8216;abc&#8217; to INT will cause an error.<\/li>\n<li><b>Your Database Already Stores Correct Types<\/b>: Don\u2019t CAST just because!<\/li>\n<\/ul>\n<p>Always test your CAST before using it in huge queries.<\/p>\n<img loading=\"lazy\" decoding=\"async\" width=\"1080\" height=\"608\" src=\"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-black-and-white-photo-of-a-person-on-a-skateboard-sql-error-failed-cast-type-mismatch.jpg\" class=\"attachment-full size-full\" alt=\"\" srcset=\"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-black-and-white-photo-of-a-person-on-a-skateboard-sql-error-failed-cast-type-mismatch.jpg 1080w, https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-black-and-white-photo-of-a-person-on-a-skateboard-sql-error-failed-cast-type-mismatch-300x169.jpg 300w, https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-black-and-white-photo-of-a-person-on-a-skateboard-sql-error-failed-cast-type-mismatch-1024x576.jpg 1024w, https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-black-and-white-photo-of-a-person-on-a-skateboard-sql-error-failed-cast-type-mismatch-575x324.jpg 575w, https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-black-and-white-photo-of-a-person-on-a-skateboard-sql-error-failed-cast-type-mismatch-768x432.jpg 768w\" sizes=\"(max-width: 1080px) 100vw, 1080px\" \/>\n<h2>Bonus: Using TRY_CAST<\/h2>\n<p>Some databases (like SQL Server) have <b>TRY_CAST<\/b>. It&#8217;s like CAST, but safer.<\/p>\n<p>Instead of throwing an error, it returns NULL when it fails.<\/p>\n<pre><code>\nSELECT TRY_CAST('oops' AS INT) AS result;\n-- Output: NULL\n<\/code><\/pre>\n<p>This is great for cleaning messy data or avoiding query crashes.<\/p>\n<h2>Real World Example<\/h2>\n<p>Let\u2019s say you have a table of survey responses, and a column is stored as text\u2014like \u201cage\u201d values.<\/p>\n<p>To calculate the average age, you\u2019ll need to turn those text values into numbers:<\/p>\n<pre><code>\nSELECT AVG(CAST(age AS INT)) AS average_age\nFROM survey;\n<\/code><\/pre>\n<p>Now you\u2019ve got useful data from a weird column. That\u2019s the power of CAST!<\/p>\n<h2>Recap<\/h2>\n<p>CAST is your best friend when dealing with mismatched data types in SQL. It helps you:<\/p>\n<ul>\n<li>Convert text into numbers (and vice versa)<\/li>\n<li>Manipulate dates and floats correctly<\/li>\n<li>Avoid frustrating errors with comparisons<\/li>\n<\/ul>\n<p>Use CAST often, but use it smartly.<\/p>\n<h2>Final Tips<\/h2>\n<ul>\n<li><b>Start small<\/b>: Try casting one column before using it everywhere.<\/li>\n<li><b>Check for NULLs<\/b>: Invalid casts may result in missing data.<\/li>\n<li><b>Use TRY_CAST<\/b> when you think conversion could fail.<\/li>\n<\/ul>\n<p>And most importantly\u2014have fun querying!<\/p>\n<p>SQL is cool. CAST makes it cooler.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ever tried adding a date to a number in SQL? Or comparing a string to an integer? If you have, chances are you hit an error or got strange results. That\u2019s because SQL is strict about data types. Enter the magical tool: <i>CAST<\/i>. It lets you convert data from one type to another\u2014safely and smartly. <\/p>\n<p class=\"read-more-container\"><a href=\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/\" class=\"read-more button\">Read more<\/a><\/p>\n","protected":false},"author":91,"featured_media":8849,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8848","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","no-featured-image-padding"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>SQL cast: Converting Data Types in Queries<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL cast: Converting Data Types in Queries\" \/>\n<meta property=\"og:description\" content=\"Ever tried adding a date to a number in SQL? Or comparing a string to an integer? If you have, chances are you hit an error or got strange results. That\u2019s because SQL is strict about data types. Enter the magical tool: CAST. It lets you convert data from one type to another\u2014safely and smartly. Read more\" \/>\n<meta property=\"og:url\" content=\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/\" \/>\n<meta property=\"og:site_name\" content=\"Resize my Image Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webfactoryltd\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-12-06T22:10:55+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-06T22:20:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-computer-screen-with-a-program-running-on-it-sql-query-cast-function-convert-data-types.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1080\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jame Miller\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webfactoryltd\" \/>\n<meta name=\"twitter:site\" content=\"@webfactoryltd\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jame Miller\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/\"},\"author\":{\"name\":\"Jame Miller\",\"@id\":\"https:\/\/resizemyimg.com\/blog\/#\/schema\/person\/4bece8cd1b5bcd61a4e5dab002eb7dca\"},\"headline\":\"SQL cast: Converting Data Types in Queries\",\"datePublished\":\"2025-12-06T22:10:55+00:00\",\"dateModified\":\"2025-12-06T22:20:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/\"},\"wordCount\":771,\"publisher\":{\"@id\":\"https:\/\/resizemyimg.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-computer-screen-with-a-program-running-on-it-sql-query-cast-function-convert-data-types.jpg\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/\",\"url\":\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/\",\"name\":\"SQL cast: Converting Data Types in Queries\",\"isPartOf\":{\"@id\":\"https:\/\/resizemyimg.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-computer-screen-with-a-program-running-on-it-sql-query-cast-function-convert-data-types.jpg\",\"datePublished\":\"2025-12-06T22:10:55+00:00\",\"dateModified\":\"2025-12-06T22:20:36+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#primaryimage\",\"url\":\"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-computer-screen-with-a-program-running-on-it-sql-query-cast-function-convert-data-types.jpg\",\"contentUrl\":\"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-computer-screen-with-a-program-running-on-it-sql-query-cast-function-convert-data-types.jpg\",\"width\":1080,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/resizemyimg.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL cast: Converting Data Types in Queries\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/resizemyimg.com\/blog\/#website\",\"url\":\"https:\/\/resizemyimg.com\/blog\/\",\"name\":\"Resize my Image Blog\",\"description\":\"News, insights, tips&amp;tricks on image related business &amp; SaaS\",\"publisher\":{\"@id\":\"https:\/\/resizemyimg.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/resizemyimg.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/resizemyimg.com\/blog\/#organization\",\"name\":\"WebFactory Ltd\",\"url\":\"https:\/\/resizemyimg.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/resizemyimg.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2019\/12\/webfactory_icon.png\",\"contentUrl\":\"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2019\/12\/webfactory_icon.png\",\"width\":300,\"height\":300,\"caption\":\"WebFactory Ltd\"},\"image\":{\"@id\":\"https:\/\/resizemyimg.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webfactoryltd\/\",\"https:\/\/x.com\/webfactoryltd\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/resizemyimg.com\/blog\/#\/schema\/person\/4bece8cd1b5bcd61a4e5dab002eb7dca\",\"name\":\"Jame Miller\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/resizemyimg.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f60a3114f608fcfdd6b15a13f37f24b2?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f60a3114f608fcfdd6b15a13f37f24b2?s=96&d=monsterid&r=g\",\"caption\":\"Jame Miller\"},\"description\":\"I'm Jame Miller, a cybersecurity analyst and blogger. Sharing knowledge on online security, data protection, and privacy issues is what I do best.\",\"url\":\"https:\/\/resizemyimg.com\/blog\/author\/jamesm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"SQL cast: Converting Data Types in Queries","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/","og_locale":"en_US","og_type":"article","og_title":"SQL cast: Converting Data Types in Queries","og_description":"Ever tried adding a date to a number in SQL? Or comparing a string to an integer? If you have, chances are you hit an error or got strange results. That\u2019s because SQL is strict about data types. Enter the magical tool: CAST. It lets you convert data from one type to another\u2014safely and smartly. Read more","og_url":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/","og_site_name":"Resize my Image Blog","article_publisher":"https:\/\/www.facebook.com\/webfactoryltd\/","article_published_time":"2025-12-06T22:10:55+00:00","article_modified_time":"2025-12-06T22:20:36+00:00","og_image":[{"width":1080,"height":720,"url":"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-computer-screen-with-a-program-running-on-it-sql-query-cast-function-convert-data-types.jpg","type":"image\/jpeg"}],"author":"Jame Miller","twitter_card":"summary_large_image","twitter_creator":"@webfactoryltd","twitter_site":"@webfactoryltd","twitter_misc":{"Written by":"Jame Miller","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#article","isPartOf":{"@id":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/"},"author":{"name":"Jame Miller","@id":"https:\/\/resizemyimg.com\/blog\/#\/schema\/person\/4bece8cd1b5bcd61a4e5dab002eb7dca"},"headline":"SQL cast: Converting Data Types in Queries","datePublished":"2025-12-06T22:10:55+00:00","dateModified":"2025-12-06T22:20:36+00:00","mainEntityOfPage":{"@id":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/"},"wordCount":771,"publisher":{"@id":"https:\/\/resizemyimg.com\/blog\/#organization"},"image":{"@id":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#primaryimage"},"thumbnailUrl":"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-computer-screen-with-a-program-running-on-it-sql-query-cast-function-convert-data-types.jpg","articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/","url":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/","name":"SQL cast: Converting Data Types in Queries","isPartOf":{"@id":"https:\/\/resizemyimg.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#primaryimage"},"image":{"@id":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#primaryimage"},"thumbnailUrl":"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-computer-screen-with-a-program-running-on-it-sql-query-cast-function-convert-data-types.jpg","datePublished":"2025-12-06T22:10:55+00:00","dateModified":"2025-12-06T22:20:36+00:00","breadcrumb":{"@id":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#primaryimage","url":"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-computer-screen-with-a-program-running-on-it-sql-query-cast-function-convert-data-types.jpg","contentUrl":"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2025\/12\/a-computer-screen-with-a-program-running-on-it-sql-query-cast-function-convert-data-types.jpg","width":1080,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/resizemyimg.com\/blog\/sql-cast-converting-data-types-in-queries\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/resizemyimg.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL cast: Converting Data Types in Queries"}]},{"@type":"WebSite","@id":"https:\/\/resizemyimg.com\/blog\/#website","url":"https:\/\/resizemyimg.com\/blog\/","name":"Resize my Image Blog","description":"News, insights, tips&amp;tricks on image related business &amp; SaaS","publisher":{"@id":"https:\/\/resizemyimg.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/resizemyimg.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/resizemyimg.com\/blog\/#organization","name":"WebFactory Ltd","url":"https:\/\/resizemyimg.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/resizemyimg.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2019\/12\/webfactory_icon.png","contentUrl":"https:\/\/resizemyimg.com\/blog\/wp-content\/uploads\/2019\/12\/webfactory_icon.png","width":300,"height":300,"caption":"WebFactory Ltd"},"image":{"@id":"https:\/\/resizemyimg.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webfactoryltd\/","https:\/\/x.com\/webfactoryltd"]},{"@type":"Person","@id":"https:\/\/resizemyimg.com\/blog\/#\/schema\/person\/4bece8cd1b5bcd61a4e5dab002eb7dca","name":"Jame Miller","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/resizemyimg.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f60a3114f608fcfdd6b15a13f37f24b2?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f60a3114f608fcfdd6b15a13f37f24b2?s=96&d=monsterid&r=g","caption":"Jame Miller"},"description":"I'm Jame Miller, a cybersecurity analyst and blogger. Sharing knowledge on online security, data protection, and privacy issues is what I do best.","url":"https:\/\/resizemyimg.com\/blog\/author\/jamesm\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/resizemyimg.com\/blog\/wp-json\/wp\/v2\/posts\/8848"}],"collection":[{"href":"https:\/\/resizemyimg.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/resizemyimg.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/resizemyimg.com\/blog\/wp-json\/wp\/v2\/users\/91"}],"replies":[{"embeddable":true,"href":"https:\/\/resizemyimg.com\/blog\/wp-json\/wp\/v2\/comments?post=8848"}],"version-history":[{"count":1,"href":"https:\/\/resizemyimg.com\/blog\/wp-json\/wp\/v2\/posts\/8848\/revisions"}],"predecessor-version":[{"id":8862,"href":"https:\/\/resizemyimg.com\/blog\/wp-json\/wp\/v2\/posts\/8848\/revisions\/8862"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/resizemyimg.com\/blog\/wp-json\/wp\/v2\/media\/8849"}],"wp:attachment":[{"href":"https:\/\/resizemyimg.com\/blog\/wp-json\/wp\/v2\/media?parent=8848"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/resizemyimg.com\/blog\/wp-json\/wp\/v2\/categories?post=8848"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/resizemyimg.com\/blog\/wp-json\/wp\/v2\/tags?post=8848"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}