| 
                                    
                                        |  | SQL Server Error Messages - Msg 234Error MessageServer: Msg 234, Level 16, State 2, Line 1
There is insufficient result space to convert a money 
value to varchar / nvarchar / char / nchar.
 This error occurs when converting, either implicitly or explicitly using the CASTorCONVERTfunctions, aMONEYvalue to aVARCHAR, NVARCHAR, CHAR or NCHARvalue and the length specified is not long enough to accommodate theMONEYvalue. |  To illustrate, here's how the error can occur using an implicit conversion of a MONEYdata type to aVARCHARdata type: DECLARE @Money MONEY
DECLARE @VarChar VARCHAR(8)
SET @Money = 100000.00
SET @VarChar = @Money
 Msg 234, Level 16, State 2, Line 5
There is insufficient result space to convert a money value to varchar.
 The total number of characters needed to convert the MONEYtoVARCHARin this example is 9 and not 8 as the decimal point has to be included as a character in the output. Here's another way of encountering the error using an explicit conversion from a MONEYdata type toNVARCHARdata type using either theCASTorCONVERTfunctions: DECLARE @Money MONEY
SET @Money = 100000.00
SELECT CAST(@Money AS NVARCHAR(8))
 Msg 234, Level 16, State 2, Line 3
There is insufficient result space to convert a money value to nvarchar.
   Figure 1: Error Message 234 - Insufficient Result Space to Convert MONEY Value to NVARCHARA similar way of getting this error is with negative MONEYvalues, as illustrated in the following, which uses theCONVERTfunction this time: DECLARE @Money MONEY
SET @Money = -100000.00
SELECT CONVERT(CHAR(9), @Money)
 Msg 234, Level 16, State 2, Line 3
There is insufficient result space to convert a money value to varchar.
   Figure 2: Error Message 234 - Insufficient Result Space to Convert MONEY Value to VARCHARSolution / Work AroundThis error can easily be avoided by making sure that the length of the VARCHAR, NVARCHAR, CHAR or NCHARvariable is long enough to accommodate the length of the MONEY value, taking into account the decimal point and the negative sign in the case of negative values. Using the first example earlier using the implicit conversion, by increasing the length of the VARCHARlocal variable to 9 (or higher), the error will be avoided: DECLARE @Money MONEY
DECLARE @VarChar VARCHAR(9)
SET @Money = 100000.00
SET @VarChar = @Money
 Similarly, the error can be avoided in the explicit conversion example earlier by also increasing the length of the NVARCHARlocal variable to 9 (or higher): DECLARE @Money MONEY
SET @Money = 100000.00
SELECT CAST(@Money AS NVARCHAR(9)) AS [NVarCharValue]
 | NVarCharValue |
|---------------|
| 100000.00     |
   Figure 3: Error Message 234 - CAST Solution 1Alternatively, instead of specifying the length of the NVARCHARdata type in theCASTfunction, you can just leave it out and the default length of 30 will be used. DECLARE @Money MONEY
SET @Money = 100000.00
SELECT CAST(@Money AS NVARCHAR) AS [NVarCharValue]
 | NVarCharValue |
|---------------|
| 100000.00     |
   Figure 4: Error Message 234 - CAST Solution 2As for the negative MONEYvalue example earlier, make sure that the length of theCHARdata type takes into consideration both the decimal point as well as the negative sign.  Increasing the length of the CHAR data type from 9 to 10 will avoid this error: DECLARE @Money MONEY
SET @Money = -100000.00
SELECT CONVERT(CHAR(10), @Money) AS [NegativeMoney]
 | NegativeMoney |
|---------------|
| -100000.00    |
   Figure 5: Error Message 234 - CONVERT Solution 1As was the case with the CASTconversion function, you can just leave out the length of theCHAR, VARCHAR, NCHAR or NVARCHARin theCONVERTfunction and the default length of 30 will be assigned. DECLARE @Money MONEY
SET @Money = -100000.00
SELECT CONVERT(CHAR, @Money) AS [NegativeMoney],
       LEN(CONVERT(CHAR, @Money)) AS [NegativeMoneyCharLength]
 | NegativeMoney                  | NegativeMoneyCharLength |
|--------------------------------|-------------------------|
|                     -100000.00 |                      30 |
   Figure 6: Error Message 234 - CONVERT Solution 2 |