Advertisement

06.13.2008 at 01:45PM PDT, ID: 23484036
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.5

International Currency Format not updateing properly

Asked by william_melvin in SQL Server 2005, MS SQL Server

Tags: , ,

I have attached a code snippet that creates the database and user that I am using to connect.  My question is that since Portuguese (Brazil) regional settings use the format for currency values R $999.999.999,99 where the decimal separator is ',' and the thousand separator is '.' When i  execute the insert statement as contained within the snippet, I get a value inserted into the database 23334.00 instead of the 233.34 as I would expect, since I am setting the language to Portuguese prior to issuing the command.

I have similar results when issuing the update statement:

Update Test
Set CurrencyValue = '$223,33'
Where RecordID = 1

Obviously, if I don't put the single quotes around the dollar amount, I get an error saying that there are too many parameters for the inset query, and in the update statement from above I get an error saying 'Syntax error near 33', which comes from the ',33' portion of the update statement.

Any help would be greatly appreciated.

Thanks,

William
(william@melvinconsultinggroup.com)
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
-- SQL script
 
USE [master]
GO
/****** Object:  Database [test_db]    Script Date: 06/13/2008 13:11:25 ******/
CREATE DATABASE [test_db] ON  PRIMARY 
( NAME = N'test_db', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\test_db.mdf' , SIZE = 2048KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
 LOG ON 
( NAME = N'test_db_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\test_db_log.ldf' , SIZE = 1024KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
GO
EXEC dbo.sp_dbcmptlevel @dbname=N'test_db', @new_cmptlevel=90
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [test_db].[dbo].[sp_fulltext_database] @action = 'disable'
end
GO
ALTER DATABASE [test_db] SET ANSI_NULL_DEFAULT OFF 
GO
ALTER DATABASE [test_db] SET ANSI_NULLS OFF 
GO
ALTER DATABASE [test_db] SET ANSI_PADDING OFF 
GO
ALTER DATABASE [test_db] SET ANSI_WARNINGS OFF 
GO
ALTER DATABASE [test_db] SET ARITHABORT OFF 
GO
ALTER DATABASE [test_db] SET AUTO_CLOSE OFF 
GO
ALTER DATABASE [test_db] SET AUTO_CREATE_STATISTICS ON 
GO
ALTER DATABASE [test_db] SET AUTO_SHRINK OFF 
GO
ALTER DATABASE [test_db] SET AUTO_UPDATE_STATISTICS ON 
GO
ALTER DATABASE [test_db] SET CURSOR_CLOSE_ON_COMMIT OFF 
GO
ALTER DATABASE [test_db] SET CURSOR_DEFAULT  GLOBAL 
GO
ALTER DATABASE [test_db] SET CONCAT_NULL_YIELDS_NULL OFF 
GO
ALTER DATABASE [test_db] SET NUMERIC_ROUNDABORT OFF 
GO
ALTER DATABASE [test_db] SET QUOTED_IDENTIFIER OFF 
GO
ALTER DATABASE [test_db] SET RECURSIVE_TRIGGERS OFF 
GO
ALTER DATABASE [test_db] SET  ENABLE_BROKER 
GO
ALTER DATABASE [test_db] SET AUTO_UPDATE_STATISTICS_ASYNC OFF 
GO
ALTER DATABASE [test_db] SET DATE_CORRELATION_OPTIMIZATION OFF 
GO
ALTER DATABASE [test_db] SET TRUSTWORTHY OFF 
GO
ALTER DATABASE [test_db] SET ALLOW_SNAPSHOT_ISOLATION OFF 
GO
ALTER DATABASE [test_db] SET PARAMETERIZATION SIMPLE 
GO
ALTER DATABASE [test_db] SET  READ_WRITE 
GO
ALTER DATABASE [test_db] SET RECOVERY SIMPLE 
GO
ALTER DATABASE [test_db] SET  MULTI_USER 
GO
ALTER DATABASE [test_db] SET PAGE_VERIFY CHECKSUM  
GO
ALTER DATABASE [test_db] SET DB_CHAINING OFF 
 
USE [test_db]
GO
/****** Object:  User [cwxsa]    Script Date: 06/13/2008 13:10:57 ******/
CREATE USER [cwxsa] FOR LOGIN [cwxsa] WITH DEFAULT_SCHEMA=[dbo]
GO
/****** Object:  Table [dbo].[test]    Script Date: 06/13/2008 13:10:57 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[test](
	[RecordID] [int] IDENTITY(1,1) NOT NULL,
	[StringValue] [varchar](100) NOT NULL CONSTRAINT [DF_test_StringValue]  DEFAULT (''),
	[CurrencyValue] [money] NOT NULL CONSTRAINT [DF_test_CurrencyValue]  DEFAULT ((0.00)),
	[DateValue] [datetime] NOT NULL CONSTRAINT [DF_test_DateValue]  DEFAULT (((1900)-(1))-(1))
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
 
-- End SQL Script
 
 
 
-- SQL script to insert Currency value
 
SET LANGUAGE Portuguese
 
Insert Into Test (StringValue, DateValue, CurrencyValue) Values
('String Value 1', '03/03/2008', '233,34')
[+][-]06.16.2008 at 11:30AM PDT, ID: 21796168

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SQL Server 2005, MS SQL Server
Tags: Micosoft, SQL Server, 2005
Sign Up Now!
Solution Provided By: dportas
Participating Experts: 1
Solution Grade: A
 
 
[+][-]06.16.2008 at 01:41PM PDT, ID: 21797290

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.17.2008 at 12:17PM PDT, ID: 21806488

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]06.17.2008 at 01:00PM PDT, ID: 21806907

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]06.17.2008 at 01:07PM PDT, ID: 21806967

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080924-EE-VQP-39 / EE_QW_2_20070628