September 29, 2005 at 3:23 pm
Hi,
I am implementing a products webpage. The products table has a discount code column. I want this column to be case sensitive. The way it works now, it returns the same results for 'DISC01' and 'disc01'. I read you can specify a collation for every column. Can any tell me how to set it? I am running SQL Server 2000 on Win 2003.
Thanks.
September 29, 2005 at 3:27 pm
You specify the collation in the create table statement.
You can also use a colate function in your queries. but it will be much better/easier to do it in table definition. If no collation is specified at create time all text fields will use database default.
Create table Mytable (
[MyTableID] [int] IDENTITY (1, 1) NOT NULL ,
[Code] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL DEFAULT ('')
)
This is of course case insensative
COLLATE SQL_Latin1_General_CP1_CI_AS
and U want Case sensative which is
COLLATE SQL_Latin1_General_CP1_CS_AS
So if your table is already created try to alter table alter column
September 29, 2005 at 3:29 pm
Thanks Ray.
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply