Showing posts with label nvarchar. Show all posts
Showing posts with label nvarchar. Show all posts

Thursday, March 22, 2012

Create a database with unicode characers

Hi,

My database i have to store arabic as well as english. I read in the forum, it says we have to use nchar or nvarchar as data type for the column to store unicode data.

But i have to create only the database with unicode character set.Because the software am gng to install itself creates the table for the database.

Any solutions?

Regs,

Priya

unfortunately, there isn't a way. if the table is created with varchar, the column is defined as varchar.|||

English and Arabic characters are included in the 1256 codepage and you don’t have to use “Unicode” if the target machines have Arabic support correctly. Make sure your regional settings are set to Arabic and that the language of non-Unicode programs are Arabic. For more details check Arabic support in Windows.

Create a database with unicode characers

Hi,

My database i have to store arabic as well as english. I read in the forum, it says we have to use nchar or nvarchar as data type for the column to store unicode data.

But i have to create only the database with unicode character set.Because the software am gng to install itself creates the table for the database.

Any solutions?

Regs,

Priya

unfortunately, there isn't a way. if the table is created with varchar, the column is defined as varchar.|||

English and Arabic characters are included in the 1256 codepage and you don’t have to use “Unicode” if the target machines have Arabic support correctly. Make sure your regional settings are set to Arabic and that the language of non-Unicode programs are Arabic. For more details check Arabic support in Windows.

Tuesday, February 14, 2012

counter of the group by statment

hi,

Lets say I have a table called test

create table test(

number int,

[str] nvarchar(50)

)

table content, for example:

8,'a'

8,'b'

8,'c'

5,'a'

5,'h'

I want to get a result with one more column that indicates on the asc counter

of the group by clause. i.e.

somthing like this:

number counter

8, 1

5, 2

and so on...

it does not realy matter regarding the query - All I want is to add one more column to the query that indicates on the count of the group by.so if i have 2 rows with number 8 and 2 rows with number 5 I would like to see in that column 1 (at the 8 number rows) and 2 (on the 5 number rows) and so on.. as the number is changing the counter is going up by 1.

Hi,

I think you might need to take a look at the RANK function: http://msdn2.microsoft.com/en-us/library/ms176102.aspx

Greetz,

Geert

Geert Verhoeven
Consultant @. Ausy Belgium

My Personal Blog

|||

You can use the dense_rank function to do this. The sample query assumes that you want to return all rows

create table #test(

number int,

[str] nvarchar(50)

)

insert into #test
select 8,'a'
union all
select 8,'b'
union all
select 8,'c'
union all
select 5,'a'
union all
select 5,'h'

select number,
dense_rank() over (order by number) as dense_rank
from #test

drop table #test
go

number dense_rank
-- --
5 1
5 1
8 2
8 2
8 2

|||

Hi,

Thank you for this info, but I need to use this rank in my where clause:

select number,

dense_rank() over (order by number) as dense_rank

from #test

where dense_rank = 1

but i get an error. How can I use it in the where clause?

thx