|
 |
asp_databases thread: Prolems with Stored Procedure and decimal numbers
Message #1 by Schoeppl Alexander <alexander.schoeppl@b...> on Mon, 19 Feb 2001 09:45:19 +0100
|
|
Hi,
I have a "simple" question:
I have got a table, where I store prices. The field for the Price is a
decimal field. I want to use a stored Procedure (microsoft sql server 7.0),
which I use in a VB Component to fill in the prices.
As long as I don't use prices with a comma (e.g. 12000) , everything is
fine.
DECLARE @return_value Integer EXEC @return_value = prc_addPrice
115, 3, 1, 1, 12000, 0 SELECT @return_value AS iNewPrice_ID
But when I have a price like "99,99" (Austrian number format) the following
statement is generated:
DECLARE @return_value Integer EXEC @return_value = prc_addPrice
115, 3, 1, 1, 99,99 , 0 SELECT @return_value AS iNewPrice_ID
I also tried 99.99 which also didn't work.
Does anyone know some help for this Problem?
Is there a special sign which tells the database that a number follows like
the '' for strings?
I read a lot of documentation but I didn't found anything about my problem.
I also experimented a lot with the Enterprise Manager, but I didn't found
any solution for this problem.
hopefully
Alexander Schoppl
Message #2 by "Dallas Martin" <dmartin@z...> on Mon, 19 Feb 2001 22:08:33 -0500
|
|
Here is a direct quote from SQL Books Online
REPLACE (T-SQL)
Replaces all occurrences of the second given string expression in the first
string expression with a third expression.
Syntax
REPLACE('string_expression1', 'string_expression2', 'string_expression3')
Arguments
'string_expression1'
Is the string expression to search for string_expression2.
string_expression1 can be of character or binary data.
'string_expression2'
Is the string expression for which to search in string_expression1 and to
replace with string_expression3. string_expression2 can be of character or
binary data.
'string_expression3'
Is the new string expression that replaces string_expression2 in
string_expression1. string_expression3 can be of character or binary data.
Return Types
Returns character data if string_expression (1, 2, or 3) is one of the
supported character data types. Returns binary data if string_expression (1,
2, or 3) is one of the supported binary data types.
Examples
This example replaces the string cde in abcdefghi with xxx.
SELECT REPLACE('abcdefghicde','cde','xxx')
GO
Here is the result set:
------------------------------------------------------------------------
abxxxfghixxx
(1 row(s) affected)
Does this give you any ideas on how to implement this in your code?
Dallas Martin
----- Original Message -----
From: "Schoeppl Alexander" <alexander.schoeppl@b...>
To: "ASP Databases" <asp_databases@p...>
Sent: Monday, February 19, 2001 3:45 AM
Subject: [asp_databases] Prolems with Stored Procedure and decimal numbers
> Hi,
>
> I have a "simple" question:
>
> I have got a table, where I store prices. The field for the Price is a
> decimal field. I want to use a stored Procedure (microsoft sql server
7.0),
> which I use in a VB Component to fill in the prices.
> As long as I don't use prices with a comma (e.g. 12000) , everything is
> fine.
>
> DECLARE @return_value Integer EXEC @return_value = prc_addPrice
> 115, 3, 1, 1, 12000, 0 SELECT @return_value AS iNewPrice_ID
>
> But when I have a price like "99,99" (Austrian number format) the
following
> statement is generated:
> DECLARE @return_value Integer EXEC @return_value = prc_addPrice
> 115, 3, 1, 1, 99,99 , 0 SELECT @return_value AS iNewPrice_ID
>
> I also tried 99.99 which also didn't work.
>
> Does anyone know some help for this Problem?
>
> Is there a special sign which tells the database that a number follows
like
> the '' for strings?
>
> I read a lot of documentation but I didn't found anything about my
problem.
> I also experimented a lot with the Enterprise Manager, but I didn't found
> any solution for this problem.
>
> hopefully
>
> Alexander Schoppl
>
>
|
|
 |