SQL Server中文大写金额转化函数
为了能够在报告中直接输入大写金额,本人编写了这个SQL Server的函数. 复制以下代码到SQL Server 查询分析器中运行,生成自定义函数 usf_ChineseCost. 在查询语句中调用该函数就可以输出大写的金额了。 SQL Server 中文金额 大写金额 CREATE FUNCTION usf_Ch
为了能够在报告中直接输入大写金额,本人编写了这个SQL Server的函数. 复制以下代码到SQL Server 查询分析器中运行,生成自定义函数 usf_ChineseCost. 在查询语句中调用该函数就可以输出大写的金额了。
CREATE FUNCTION usf_ChineseCost ( @Cost float ) RETURNS varchar(50) AS ----大写钱数---- BEGIN declare @returnStr varchar(50) if (@Cost >= 1000000000) Begin set @returnStr = '##########' return @returnStr end set @returnStr = '00000000000' set @returnStr = right(@returnStr + convert(varchar,convert(decimal(11,2),round(@cost,2))),12) set @returnStr = replace(@returnStr,'0','零') set @returnStr = replace(@returnStr,'1','壹') set @returnStr = replace(@returnStr,'2','贰') set @returnStr = replace(@returnStr,'3','叁') set @returnStr = replace(@returnStr,'4','肆') set @returnStr = replace(@returnStr,'5','伍') set @returnStr = replace(@returnStr,'6','陆') set @returnStr = replace(@returnStr,'7','柒') set @returnStr = replace(@returnStr,'8','捌') set @returnStr = replace(@returnStr,'9','玖') set @returnStr = @returnStr + '分' set @returnStr = stuff(@returnStr,len(@returnStr)-1,0,'角') set @returnStr = replace(@returnStr,'.','元') set @returnStr = stuff(@returnStr,len(@returnStr)-5,0,'拾') set @returnStr = stuff(@returnStr,len(@returnStr)-7,0,'百') set @returnStr = stuff(@returnStr,len(@returnStr)-9,0,'千') set @returnStr = stuff(@returnStr,len(@returnStr)-11,0,'万') set @returnStr = stuff(@returnStr,len(@returnStr)-13,0,'拾') set @returnStr = stuff(@returnStr,len(@returnStr)-15,0,'百') set @returnStr = stuff(@returnStr,len(@returnStr)-17,0,'千') set @returnStr = stuff(@returnStr,len(@returnStr)-19,0,'亿') set @returnStr = replace(@returnStr,'零亿','零') set @returnStr = replace(@returnStr,'零千','零') set @returnStr = replace(@returnStr,'零百','零') set @returnStr = replace(@returnStr,'零拾','零') set @returnStr = replace(@returnStr,'零零零','零') set @returnStr = replace(@returnStr,'零零','零') set @returnStr = replace(@returnStr,'零万','万') set @returnStr = replace(@returnStr,'零元','元') set @returnStr = replace(@returnStr,'零角','零') set @returnStr = replace(@returnStr,'零分','') while left(@returnStr,1) = '零' Begin set @returnStr = right(@returnStr,len(@returnStr)-1) end if ((left(@returnStr,1)='万')) begin set @returnStr = right(@returnStr,len(@returnStr)-1) end if ((left(@returnStr,1)='元')) begin set @returnStr = right(@returnStr,len(@returnStr)-1) end while left(@returnStr,1) = '零' Begin set @returnStr = right(@returnStr,len(@returnStr)-1) end while right(@returnStr,1) = '零' Begin set @returnStr = left(@returnStr,len(@returnStr)-1) end set @returnStr = replace(@returnStr,'亿万','亿零') set @returnStr = replace(@returnStr,'零元','元') set @returnStr = replace(@returnStr,'零零零','零') set @returnStr = replace(@returnStr,'零零','零') if (@returnStr='') begin set @returnStr = '零元' end if ((right(@returnStr,1)='元')) begin set @returnStr = @returnStr + '整' end return @returnStr END

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











Go language provides two dynamic function creation technologies: closure and reflection. closures allow access to variables within the closure scope, and reflection can create new functions using the FuncOf function. These technologies are useful in customizing HTTP routers, implementing highly customizable systems, and building pluggable components.

In C++ function naming, it is crucial to consider parameter order to improve readability, reduce errors, and facilitate refactoring. Common parameter order conventions include: action-object, object-action, semantic meaning, and standard library compliance. The optimal order depends on the purpose of the function, parameter types, potential confusion, and language conventions.

1. The SUM function is used to sum the numbers in a column or a group of cells, for example: =SUM(A1:J10). 2. The AVERAGE function is used to calculate the average of the numbers in a column or a group of cells, for example: =AVERAGE(A1:A10). 3. COUNT function, used to count the number of numbers or text in a column or a group of cells, for example: =COUNT(A1:A10) 4. IF function, used to make logical judgments based on specified conditions and return the corresponding result.

The key to writing efficient and maintainable Java functions is: keep it simple. Use meaningful naming. Handle special situations. Use appropriate visibility.

Exception handling in C++ can be enhanced through custom exception classes that provide specific error messages, contextual information, and perform custom actions based on the error type. Define an exception class inherited from std::exception to provide specific error information. Use the throw keyword to throw a custom exception. Use dynamic_cast in a try-catch block to convert the caught exception to a custom exception type. In the actual case, the open_file function throws a FileNotFoundException exception. Catching and handling the exception can provide a more specific error message.

When passing a map to a function in Go, a copy will be created by default, and modifications to the copy will not affect the original map. If you need to modify the original map, you can pass it through a pointer. Empty maps need to be handled with care, because they are technically nil pointers, and passing an empty map to a function that expects a non-empty map will cause an error.

Function return value is crucial in C++, which allows the function to return data of a specified type: the return value type defines the type of data returned by the function, including basic types (such as int, float) and custom types (such as pointers, references). The return value meaning varies based on the function's intent, such as returning a result, indicating status, providing a reference, or creating a new object.

Advanced Go function techniques include: Closure: used to access externally defined variables, which can encapsulate state and create private variables. Anonymous function: An unnamed function used for one-time operations, suitable for callbacks, event handling, and filtering. Function type: Define function signature, which can store and transfer function values for scenarios such as comparison and sorting.
