使用SqlServer中的float类型时发现的问题
SQL Server 中Float类型 如何转换成 Varchar类型 ? 方法 如下 : float转化成varchar类型 select convert(varchar(8000),cast(convert(float,'12345678900') as decimal)) select str(convert(float,'123456789000'),len(convert(float,'123456789000'))) s

SQL Server 中Float类型 如何转换成 Varchar类型 ?
方法 如下 :
float转化成varchar类型
select convert(varchar(8000),cast(convert(float,'12345678900') as decimal))
select str(convert(float,'123456789000'),len(convert(float,'123456789000')))
select convert(varchar(8000),cast(convert(float,'12345678900') as decimal))
STR ( float_expression [ , length [ , ] ] )
备注
如果为 STR 提供 length 和 decimal 参数值,则这些值应该是正数。在默认情况下或小数参数为 0 时,数字舍入为整数。指定的长度应大于或等于小数点前面的部分加上数字符号(如果有)的长度。短的 float_expression 在指定长度内右对齐,长的 float_expression 则截断为指定的小数位数。例如,STR(12,10) 输出的结果是 12。它在结果集内右对齐。而 STR(1223,2) 则将结果集截断为 **。可以嵌套字符串函数。
注意:
若要转换为 Unicode 数据,请在 CONVERT 或 CAST 转换函数内使用 STR。
参数
float_expression
带小数点的近似数字 (float) 数据类型的表达式。
length
总长度。它包括小数点、符号、数字以及空格。默认值为 10。
decimal
小数点后的位数。decimal 必须小于或等于 16。如果 decimal 大于 16,则会截断结果,使其保持为小数点后具有十六位。
返回类型
char

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics











The import steps are as follows: Copy the MDF file to SQL Server's data directory (usually C:\Program Files\Microsoft SQL Server\MSSQL\DATA). In SQL Server Management Studio (SSMS), open the database and select Attach. Click the Add button and select the MDF file. Confirm the database name and click the OK button.

For objects with the same name that already exist in the SQL Server database, the following steps need to be taken: Confirm the object type (table, view, stored procedure). IF NOT EXISTS can be used to skip creation if the object is empty. If the object has data, use a different name or modify the structure. Use DROP to delete existing objects (use caution, backup recommended). Check for schema changes to make sure there are no references to deleted or renamed objects.

To view the SQL Server port number: Open SSMS and connect to the server. Find the server name in Object Explorer, right-click it and select Properties. In the Connection tab, view the TCP Port field.

If you accidentally delete a SQL Server database, you can take the following steps to recover: stop database activity; back up log files; check database logs; recovery options: restore from backup; restore from transaction log; use DBCC CHECKDB; use third-party tools. Please back up your database regularly and enable transaction logging to prevent data loss.

SQL Server database files are usually stored in the following default location: Windows: C:\Program Files\Microsoft SQL Server\MSSQL\DATALinux: /var/opt/mssql/data The database file location can be customized by modifying the database file path setting.

MetaMask (also called Little Fox Wallet in Chinese) is a free and well-received encryption wallet software. Currently, BTCC supports binding to the MetaMask wallet. After binding, you can use the MetaMask wallet to quickly log in, store value, buy coins, etc., and you can also get 20 USDT trial bonus for the first time binding. In the BTCCMetaMask wallet tutorial, we will introduce in detail how to register and use MetaMask, and how to bind and use the Little Fox wallet in BTCC. What is MetaMask wallet? With over 30 million users, MetaMask Little Fox Wallet is one of the most popular cryptocurrency wallets today. It is free to use and can be installed on the network as an extension

When the SQL Server service fails to start, here are some steps to resolve: Check the error log to determine the root cause. Make sure the service account has permission to start the service. Check whether dependency services are running. Disable antivirus software. Repair SQL Server installation. If the repair does not work, reinstall SQL Server.

NetEase Mailbox, as an email address widely used by Chinese netizens, has always won the trust of users with its stable and efficient services. NetEase Mailbox Master is an email software specially created for mobile phone users. It greatly simplifies the process of sending and receiving emails and makes our email processing more convenient. So how to use NetEase Mailbox Master, and what specific functions it has. Below, the editor of this site will give you a detailed introduction, hoping to help you! First, you can search and download the NetEase Mailbox Master app in the mobile app store. Search for "NetEase Mailbox Master" in App Store or Baidu Mobile Assistant, and then follow the prompts to install it. After the download and installation is completed, we open the NetEase email account and log in. The login interface is as shown below
