Showing posts with label store. Show all posts
Showing posts with label store. Show all posts

Monday, March 19, 2012

how to design database for chinese and japanese characters

I need a small confirmation regarding storing the Chinese and Japanese characters in sql server. Can we store Chinese and Japanese characters on a same database with Chinese Collation? Or else we need to store it separately with respective collations.

I tried to store both characters on db with Chinese collation it works but I am not so sure if it is right way to do so. Please confirm on this as we are doing research stage to build website in Chinese and japanese.

Thanks in advance.

Moving to SQL Server Setup and Upgrade|||

vrkanaka wrote:

I need a small confirmation regarding storing the Chinese and Japanese characters in sql server. Can we store Chinese and Japanese characters on a same database with Chinese Collation? Or else we need to store it separately with respective collations.

I tried to store both characters on db with Chinese collation it works but I am not so sure if it is right way to do so. Please confirm on this as we are doing research stage to build website in Chinese and japanese.

Thanks in advance.

The Chinese and Japanese alphabets are more than 2000 characters so you need to find the version of Chinese and Japanese and use the correct code page and collations for each language with NVarchar or NVarchar(max). Hope this helps.

http://msdn2.microsoft.com/en-us/library/ms144250.aspx


http://msdn2.microsoft.com/en-us/library/ms180175.aspx

Sunday, February 19, 2012

How to define Hierarchy

Hi all,

I have a Store dimension that has 4 attributes.

Store

Category

Department

Store Key (Key column)

|_Store, Category, Department

Then I have creaet one Hierachy as follow:

Store->Category->Department

But I get a warning message "Attribute relationship doesn't exist in one or more level". Do I need to worry about it?

I know how to solve this warning message by creating a member property of the attribute for a level on the level below, but the problem is a Department can be in different Category in different Store. If I apply this solution, then the hierachy can't display correctly

Thanks

Hello! If you check the attribute relation in a natural or user hierarchy they can only have one-to-one or one-to-many relations.

So a child in a natural hierarchy cannot point to more than parent. If they point to several you will have random results when you analyze data. I think that SSAS2005 will pick the first parent it finds and ignore the others.

In your natural hierarchy department can only point to one parent(category).

HTH

Thomas Ivarsson

|||

Take a look at this site, and see if it helps you..

http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1262358,00.html

|||

Thanks, this site is really helpfull. I think I can define the un-natural hierarchies on my Store dimension, but I need to suffer the query performance.

How to define field attribute for a numeric field in SQL table?

I need create a field to store tax rate. I need only 2 decimal points. I defined the field as decimal, precision=5 and scale=2. Does it mean that it can hold value from 0.00 to 999.99?Actually, it should be able to hold from -999.99 through 999.99.

Terri|||True... here comes my really problem. My aspx form always does rounding for me while I update the table. If I enter 0.7 it will become 0 in the table. If I enter 2.7 it will become 3 in the table. What is the trick?|||You'll have to show us your code surrounding the SQL command. It's probably in how your data type is set up in your SQLParameter or something along those lines. There's no trick from a SQL perspective -- a command from Query Analyzer would simply look like this:


UPDATE test SET taxRate = '.7' WHERE ID = 10

Terri|||Try Numeric it will make the rounding problem go away in SQL Server, in .NET search MSDN for Strings and Formating in your language. Numeric is bigger than Decimal. Hope this helps.

Kind regards,
Gift Peddie|||This is how I coded...

First is the class


Namespace BusinessLogicLayer
Public Class Itm
...
Private _PST As Decimal
...
Public Property PST() As Decimal
Get
Return _PST
End Get
Set(ByVal Value As Decimal)
_PST = Value
End Set
End Property
...
...
Public Function Insert() As Boolean
ItmID = Convert.ToInt32(SqlHelper.ExecuteScalar(ConfigurationSettings.AppSettings(Web.Global.CfgKeyConnString), "AddItm", CatID, ItmD1, ItmD2, UOM, UPrice, PSTPcnt, GSTPcnt, Note, MasterItem))
Return ItmID > 0
End Function 'Insert
...
End Class
End Namespace

then page load sub...

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
...
If txtPSTPcnt.Text = "" Then
txtPSTPcnt.Text = "0.07"
End If
...
End Sub

then when the Save button is clicked


Private Sub btnSave_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSave.Click
...
Itm.PST = CDec(txtPST.Text)
Itm.Insert()
End Sub

Hopefully you have some clue, thx.|||I changed it to numeric and still have the same result.|||Sorry I did not get back to you yesterday, you need code in Custom Numeric Format Strings with using statement from System.globalization. I found some code using the IFormatProvider and ICustomFormatter interfaces on codeproject site. The second link is on MSDN Custom Numeric Format Strings Output Examples table you may have to use DOUBLE datatype in .NET. Hope this helps.

http://www.codeproject.com
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomnumericformatstrings.asp

Kind regards,
Gift Peddie|||Sorry this is the table that show the DOUBLE datatypes human error lol. Hope this helps

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcustomnumericformatstringsoutputexample.asp

Kind regards,
Gift Peddie|||Thanks a lot. you're very helpful. Since this is my first project on ASP.net and SQL, I can't grap the idea of using the table you refer to. First of all, where do I define "double" and do I put those code in the ASPX.VB? Appreciated.|||The code below should take you closer to what you want, these are part of the .NET Framework Class Library that perform special tasks for you. I don't know books that covers it in VB.NET but in C# the Complete Reference by Herbert Schildt covered it in details in C# not Asp.net. Hope this helps.

NumberFormatInfo.PercentDecimalSeparator Property
[Visual Basic]the effect of changing the PercentDecimalSeparator property.

[Visual Basic]
Imports System
Imports System.Globalization

Class NumberFormatInfoSample

Public Shared Sub Main()

' Gets a NumberFormatInfo associated with the en-US culture.
Dim nfi As NumberFormatInfo = New CultureInfo("en-US", False).NumberFormat

' Displays a value with the default separator (".").
Dim myInt As [Double] = 0.1234
Console.WriteLine(myInt.ToString("P", nfi))

' Displays the same value with a blank as the separator.
nfi.PercentDecimalSeparator = " "
Console.WriteLine(myInt.ToString("P", nfi))

End Sub 'Main

End Class 'NumberFormatInfoSample

'This code produces the following output.

'

'12.34 %

'12 34 %

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemglobalizationnumberformatinfoclasspercentdecimalseparatortopic.asp

Kind regards,
Gift Peddie|||Again thanks for your advice, but I can't find data type Double in SQL2000. Did I miss something?|||Gentlmen, I found where the problem occured. It's because the SQL parameter wasn't defined properly. Instead of saying


(
@.PST decimal(5,2)
)

I only typed


(
@.PST decimal
)

Anyway I thank anyone participated in the threat.