Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Raiserror and numeric parameters (real, float)
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01226806
Message ID:
01226808
Vues:
17
Try

Check if %i is correct. I believe the error is in the wrong format.

See also http://www.4guysfromrolla.com/webtech/041906-1.shtml and http://msdn2.microsoft.com/en-us/library/ms177497.aspx

>Hi guys,
>
>The same code below, works fine when I run it using MSSQL 2000, but doesn't work if I try it using MSSQL 2005 (Express).
>
>
>Declare @Var1 Integer, @Var2 Numeric (9,3)
>Set @Var1 = 1
>Set @Var2 = 2
>RaisError('Var1 = %i Var2 = %i',16,1,@Var1, @Var2)
>
>
>
>2000 returns
>
>Server: Msg 50000, Level 16, State 1, Line 4
>Var1 = 1 Var2 = 2
>
>2005 returns
>
>Msg 2786, Level 16, State 1, Line 4
>The data type of substitution parameter 2 does not match the expected type of the format specification.
>
>
>The problem is @Var2 that is numeric(9,2) and is not integer. I think I have to replace the second %i. I tried to do something different, but no way.
>
>I don't want to use something like (COMPATIBLE = 2000, actually I don't know if it exists in SQL, but I want to convert my application to SQL 2005).
>
>Any idea?
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform