Thread: Equivalant of SQL Server's Nchar and NVARCHAR

Equivalant of SQL Server's Nchar and NVARCHAR

From
"kumar"
Date:
Dear friends,
Is there any equivalent datatype of SQL Server's NCHAR and NVARCHAR, available with Postgres 7.3.4. I want to store characters, special characters and Numbers.
Please shed some light.
 
Thanks
Kumar

Re: Equivalant of SQL Server's Nchar and NVARCHAR

From
Karsten Hilbert
Date:
> Dear friends,
> Is there [...]

> Please shed some light.
http://www.postgresql.org/docs/7.4/static/index.html

> Thanks
You are welcome.

Karsten
-- 
GPG key ID E4071346 @ wwwkeys.pgp.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


Re: Equivalant of SQL Server's Nchar and NVARCHAR

From
Rob
Date:
kumar wrote:

> Dear friends,
> Is there any equivalent datatype of SQL Server's NCHAR and NVARCHAR, 
> available with Postgres 7.3.4. I want to store characters, special 
> characters and Numbers.
> Please shed some light.
>  
> Thanks
> Kumar

I only only use ascii but...
I believe postgresql varchar is the same as Oracle/Sybase/MS SQL 
nvarchar even though it doesn't explicitly say so here:

http://www.postgresql.org/docs/7.4/static/datatype-character.html

Here is a short example:
create table
nvctest (
utf8fld varchar(12)
);
insert into nvctest
select convert('PostgreSQL' using ascii_to_utf_8);
select * from nvctest;

text functions including encoding conversions are here:

http://www.postgresql.org/docs/current/static/functions-string.html and
http://www.postgresql.org/docs/current/static/functions-string.html#CONVERSION-NAMES

Good Luck,

Rob


Re: Equivalant of SQL Server's Nchar and NVARCHAR

From
Josh Berkus
Date:
Kumar,

> I only only use ascii but...
> I believe postgresql varchar is the same as Oracle/Sybase/MS SQL 
> nvarchar even though it doesn't explicitly say so here:

All of our TEXT datatypes are multibyte-capable, provided you've installed 
PostgreSQL correctly.    This includes:
TEXT (recommended)
VARCHAR
CHAR

-- 
-Josh BerkusAglio Database SolutionsSan Francisco