Showing posts with label developing. Show all posts
Showing posts with label developing. Show all posts

Friday, March 30, 2012

Is unicode necessary for a English and Spanish application/database?

We may add a spanish version of the application we are currently developing in the future. Do I need to use unicode datatypes in SQL2K or are plain varchar, etc. datatypes fine? Or can we convert in the future if necessary? Thanks.
Randy
"Randy" <anonymous@.discussions.microsoft.com> wrote in message
news:FD264AD2-770E-4E25-B38B-1F887B5F1111@.microsoft.com...
> We may add a spanish version of the application we are currently
developing in the future. Do I need to use unicode datatypes in SQL2K or
are plain varchar, etc. datatypes fine? Or can we convert in the future if
necessary? Thanks.
> Randy
If you find a code page that has all the characters you need, then you can
use varchar instead of nvarchar.
The most common collation and charset in the US is
SQL_Latin1_General_CP1_CI_AI
http://www.microsoft.com/globaldev/r.../sbcs/1252.htm
It has the whole spanish alphabet, but lacks the Euro character.
David
|||Actually that charset (cp1252) does have the Euro char (at position
0x80). Randy, if you use any 1252-based collation such as the one that
David referenced you can store English or Spanish data without using
Unicode data types. In fact, code page 1252 is capable of storing most
of the Western European languages like English, Spanish, Portuguese,
German, French, Italian, etc in non-Unicode columns.
You may wish to consider Unicode for further down the road, though... if
you're adding support for Spanish today, is it possible that you may find
a market in Japan or Israel tomorrow? It's easier to start using
Unicode from the start of an app's lifetime than it is to convert an
existing one. It is possible to convert down the road, although you may
end up needing to change not just the table data types, but also stored
proc and trigger code as well as application code.
HTH,
Bart
Bart Duncan
Microsoft SQL Server Support
Please reply to the newsgroup only - thanks.
This posting is provided "AS IS" with no warranties, and confers no
rights.
From: "David Browne" <davidbaxterbrowne no potted meat@.hotmail.com>
References: <FD264AD2-770E-4E25-B38B-1F887B5F1111@.microsoft.com>
Subject: Re: Is unicode necessary for a English and Spanish
application/database?
Date: Mon, 26 Apr 2004 12:31:32 -0500
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Message-ID: <#YJUSR7KEHA.2236@.TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.sqlserver.server
NNTP-Posting-Host: airband-66-226-246-66.airband.net 66.226.246.66
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFT NGP08.phx.gbl!TK2MSFTNGP
09.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.sqlserver.server:338669
X-Tomcat-NG: microsoft.public.sqlserver.server
"Randy" <anonymous@.discussions.microsoft.com> wrote in message
news:FD264AD2-770E-4E25-B38B-1F887B5F1111@.microsoft.com...
> We may add a spanish version of the application we are currently
developing in the future. Do I need to use unicode datatypes in SQL2K or
are plain varchar, etc. datatypes fine? Or can we convert in the future
if
necessary? Thanks.
> Randy
If you find a code page that has all the characters you need, then you can
use varchar instead of nvarchar.
The most common collation and charset in the US is
SQL_Latin1_General_CP1_CI_AI
http://www.microsoft.com/globaldev/r.../sbcs/1252.htm
It has the whole spanish alphabet, but lacks the Euro character.
David

Is unicode necessary for a English and Spanish application/database?

We may add a spanish version of the application we are currently developing in the future. Do I need to use unicode datatypes in SQL2K or are plain varchar, etc. datatypes fine? Or can we convert in the future if necessary? Thanks
Randy"Randy" <anonymous@.discussions.microsoft.com> wrote in message
news:FD264AD2-770E-4E25-B38B-1F887B5F1111@.microsoft.com...
> We may add a spanish version of the application we are currently
developing in the future. Do I need to use unicode datatypes in SQL2K or
are plain varchar, etc. datatypes fine? Or can we convert in the future if
necessary? Thanks.
> Randy
If you find a code page that has all the characters you need, then you can
use varchar instead of nvarchar.
The most common collation and charset in the US is
SQL_Latin1_General_CP1_CI_AI
http://www.microsoft.com/globaldev/reference/sbcs/1252.htm
It has the whole spanish alphabet, but lacks the Euro character.
David|||Actually that charset (cp1252) does have the Euro char (at position
0x80). Randy, if you use any 1252-based collation such as the one that
David referenced you can store English or Spanish data without using
Unicode data types. In fact, code page 1252 is capable of storing most
of the Western European languages like English, Spanish, Portuguese,
German, French, Italian, etc in non-Unicode columns.
You may wish to consider Unicode for further down the road, though... if
you're adding support for Spanish today, is it possible that you may find
a market in Japan or Israel tomorrow? :) It's easier to start using
Unicode from the start of an app's lifetime than it is to convert an
existing one. It is possible to convert down the road, although you may
end up needing to change not just the table data types, but also stored
proc and trigger code as well as application code.
HTH,
Bart
--
Bart Duncan
Microsoft SQL Server Support
Please reply to the newsgroup only - thanks.
This posting is provided "AS IS" with no warranties, and confers no
rights.
From: "David Browne" <davidbaxterbrowne no potted meat@.hotmail.com>
References: <FD264AD2-770E-4E25-B38B-1F887B5F1111@.microsoft.com>
Subject: Re: Is unicode necessary for a English and Spanish
application/database?
Date: Mon, 26 Apr 2004 12:31:32 -0500
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Message-ID: <#YJUSR7KEHA.2236@.TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.sqlserver.server
NNTP-Posting-Host: airband-66-226-246-66.airband.net 66.226.246.66
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP
09.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.sqlserver.server:338669
X-Tomcat-NG: microsoft.public.sqlserver.server
"Randy" <anonymous@.discussions.microsoft.com> wrote in message
news:FD264AD2-770E-4E25-B38B-1F887B5F1111@.microsoft.com...
> We may add a spanish version of the application we are currently
developing in the future. Do I need to use unicode datatypes in SQL2K or
are plain varchar, etc. datatypes fine? Or can we convert in the future
if
necessary? Thanks.
> Randy
If you find a code page that has all the characters you need, then you can
use varchar instead of nvarchar.
The most common collation and charset in the US is
SQL_Latin1_General_CP1_CI_AI
http://www.microsoft.com/globaldev/reference/sbcs/1252.htm
It has the whole spanish alphabet, but lacks the Euro character.
David

Is unicode necessary for a English and Spanish application/database?

We may add a spanish version of the application we are currently developing
in the future. Do I need to use unicode datatypes in SQL2K or are plain var
char, etc. datatypes fine? Or can we convert in the future if necessary? Th
anks.
Randy"Randy" <anonymous@.discussions.microsoft.com> wrote in message
news:FD264AD2-770E-4E25-B38B-1F887B5F1111@.microsoft.com...
> We may add a spanish version of the application we are currently
developing in the future. Do I need to use unicode datatypes in SQL2K or
are plain varchar, etc. datatypes fine? Or can we convert in the future if
necessary? Thanks.
> Randy
If you find a code page that has all the characters you need, then you can
use varchar instead of nvarchar.
The most common collation and charset in the US is
SQL_Latin1_General_CP1_CI_AI
http://www.microsoft.com/globaldev/...e/sbcs/1252.htm
It has the whole spanish alphabet, but lacks the Euro character.
David|||Actually that charset (cp1252) does have the Euro char (at position
0x80). Randy, if you use any 1252-based collation such as the one that
David referenced you can store English or Spanish data without using
Unicode data types. In fact, code page 1252 is capable of storing most
of the Western European languages like English, Spanish, Portuguese,
German, French, Italian, etc in non-Unicode columns.
You may wish to consider Unicode for further down the road, though... if
you're adding support for Spanish today, is it possible that you may find
a market in Japan or Israel tomorrow? It's easier to start using
Unicode from the start of an app's lifetime than it is to convert an
existing one. It is possible to convert down the road, although you may
end up needing to change not just the table data types, but also stored
proc and trigger code as well as application code.
HTH,
Bart
--
Bart Duncan
Microsoft SQL Server Support
Please reply to the newsgroup only - thanks.
This posting is provided "AS IS" with no warranties, and confers no
rights.
From: "David Browne" <davidbaxterbrowne no potted meat@.hotmail.com>
References: <FD264AD2-770E-4E25-B38B-1F887B5F1111@.microsoft.com>
Subject: Re: Is unicode necessary for a English and Spanish
application/database?
Date: Mon, 26 Apr 2004 12:31:32 -0500
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
Message-ID: <#YJUSR7KEHA.2236@.TK2MSFTNGP09.phx.gbl>
Newsgroups: microsoft.public.sqlserver.server
NNTP-Posting-Host: airband-66-226-246-66.airband.net 66.226.246.66
Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA05.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP
09.phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.sqlserver.server:338669
X-Tomcat-NG: microsoft.public.sqlserver.server
"Randy" <anonymous@.discussions.microsoft.com> wrote in message
news:FD264AD2-770E-4E25-B38B-1F887B5F1111@.microsoft.com...
> We may add a spanish version of the application we are currently
developing in the future. Do I need to use unicode datatypes in SQL2K or
are plain varchar, etc. datatypes fine? Or can we convert in the future
if
necessary? Thanks.
> Randy
If you find a code page that has all the characters you need, then you can
use varchar instead of nvarchar.
The most common collation and charset in the US is
SQL_Latin1_General_CP1_CI_AI
http://www.microsoft.com/globaldev/...e/sbcs/1252.htm
It has the whole spanish alphabet, but lacks the Euro character.
David

Friday, March 9, 2012

Is there anyway to do SUM on join table?

I would like to start using SQL Server CE rather than SQLite for an application I am developing, due to it's replication support for SQL Server however there appears to be a gaping hole in it that means I can't even consider it. Specifically to do with aggregates against detail tables.

Is there any way to do the equivalent of the following in SQL using SQL Server CE?

SELECT [Customer_Id], [Customer_name], COALESCE([OT].[Count_Orders],0) [CountOrders], COALESCE([OT].[Sum_Value],0) [OrderValue] FROM [Customers] LEFT OUTER JOIN (SELECT Time.[Customer_Id], COUNT(*) [Count_Orders], SUM(Time.[Order_Value]) [Sum_Value] FROM [Orders] Time GROUP BY Time.[Customer_Id]) [OT] ON [OT].[Customer_Id] = [Customers].[Customer_Id]);

Any help would be most welcome

Adrian Heath

I think the short answer is no. The long answer is no, not in a single statement. One of the differences when you are working with such a lightweight database is that you need to adjust the way you do operations. Typically if you are writing a client application that uses sql server ce you can split the data processing load between the database (ie selecting records) and the application itself.

In the example you have provided you would have to do the aggregation by Customer_Id across the Orders table and then in memory do the join across to Customer information..

Alternatively you could just maintain an additional table with this information already aggregated - again because it is a client application and you are not expecting thousands of concurrent updates this becomes a workable solution.

|||

This works fine (from Northwind sample database) (Ship Name = Customer Name)

SELECT Orders.[Ship Name], SUM([Order Details].[Unit Price]) AS Total
FROM [Order Details] INNER JOIN
Orders ON [Order Details].[Order ID] = Orders.[Order ID]
GROUP BY Orders.[Ship Name]

Hope this assists.