About 2,300,000 results
Open links in new tab
  1. sql - replace multiple values at the same time - in order to convert

    Apr 22, 2014 · The first is to use a bunch of nested replace() statements: and so on. The second is to find the first digit and try converting from there. This requires complicated logic with patindex(). Here is an example: patindex('%[^0-9]%', substring(col, patindex('%[0-9]%', col), 1000)) - 1. ) as int) You could do this.

  2. SQL Server CONVERT() Function - W3Schools

    The CONVERT() function converts a value (of any type) into a specified datatype. Tip: Also look at the CAST() function. Syntax

  3. Examples for SQL CAST and SQL CONVERT Functions

    Sep 16, 2021 · The T-SQL language offers two functions to convert data from one data type to a target data type: CAST and CONVERT. In many ways, they both do the exact same thing in a SELECT statement or stored procedure, but the SQL Server CONVERT function has an extra parameter to express style.

  4. Sql Server using Convert and Replace together in the same …

    Jan 23, 2019 · In which case CONVERT(DECIMAL(12, 4), REPLACE(@LABORQTY, ',', '')) will indeed produce a decimal with up to 4 digits of fractional precision. Whether your query tool/programming language will output it as 1200.4200 or not is another matter entirely; it might well just output 1200.42 and drop the trailing zeroes.

  5. SQL Server CONVERT Function Explained By Practical Examples

    Mar 14, 2019 · This tutorial shows you how to use the SQL Server CONVERT() function to convert a value of one type to another.

  6. SQL CAST and SQL CONVERT function overview - SQL Shack

    Nov 16, 2018 · Sometimes we need to convert data between different SQL data types. In addition to working with data, there are some built-in functions can be used to convert the data. So let’s take a closer look at the SQL conversion functions SQL CAST and SQL CONVERT in detail.

  7. SQL Convert Function In Depth - MSSQLTips.com - SQL Server …

    Jan 20, 2022 · The CONVERT function is a conversion function that allows you to both convert data between different datatypes and format the result at the same time. Eg. convert text input to a specific date format.

  8. sql server - Using the CAST or CONVERT clause multiple times on …

    Jun 14, 2020 · CAST(ListPrice as decimal)Cast(DiscountPercent as decimal)(1-DiscountPercent/100.0) I am needing the code to select the three columns, then in the fourth column to convert to decimal, and apply the discount to the listPrice and print it …

  9. CONVERT Function in SQL Server - Examples and Alternatives

    Sep 12, 2022 · SQL CONVERT explicitly converts an expression of one data type to another with formatting. The function returns the converted value, if the conversion succeeds, or returns an error if it fails. Depending on the SQL Server version …

  10. Using CAST and CONVERT Functions in T-SQL - PiEmbSysTech

    Feb 19, 2025 · Understanding when to use CAST and when to use CONVERT can improve data manipulation and formatting in SQL Server. In this post, I will explain the differences between these functions, their syntax, and practical use cases.

  11. Some results have been removed
Refresh