Showing posts with label case. Show all posts
Showing posts with label case. Show all posts

Thursday, March 22, 2012

_wcsupr () with german characters

Hi,
I have a string which contains some german characters e.g 'Men'. I
am converting it to upper case using wcsupr (). But is not converted to .
There are other characters too. I can use the _wsetlocale () function before
using _wcsupr (). I cannot use the current machines locale setting. The
strings have to be converted to upper case based on the locale of the target
machine which is a SQL Server. What's the most efficient way of converting
the string to upper case considering the language specific characters. I
tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM code
page. This seems to be working. What's the difference in OEM code page and
language specific code page?
Thanks in advance
AjeyHi
The easiest way may be to use the UPPER function when retrieving/saving the
data
SELECT UPPER( 'Menü')
MENü
John
"Ajey" wrote:

> Hi,
> I have a string which contains some german characters e.g 'Menü'.
I
> am converting it to upper case using wcsupr (). But ü is not converted to
ü.
> There are other characters too. I can use the _wsetlocale () function befo
re
> using _wcsupr (). I cannot use the current machines locale setting. The
> strings have to be converted to upper case based on the locale of the targ
et
> machine which is a SQL Server. What's the most efficient way of converting
> the string to upper case considering the language specific characters. I
> tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM code
> page. This seems to be working. What's the difference in OEM code page and
> language specific code page?
> Thanks in advance
> Ajey
>
>|||There are many such string. I cannot use sql query for each to just make it
a upper case. Is there a way i can find out exact local the SQL Server is
using or is there any documentation of which API UPPER function insql uses.
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
news:E55039D7-F207-4131-AF23-4E603E29A38D@.microsoft.com...
> Hi
> The easiest way may be to use the UPPER function when retrieving/saving
the
> data
> SELECT UPPER( 'Men')
> --
> MEN
> John
> "Ajey" wrote:
>
I
to .
before
target
converting
code
and|||If i get the code page from the SQL Server as 1252 where as the language on
server is german but the machine where i am running the API has English,
will _wsetlocale(LC_CTYPE, L".1252") work fine. Are code page number specifc
to languages or they cover range of languages. (I want to make sure that
code page 1252 is not different for german and different for english)
"Ajey" <ajey5@.hotmail.com> wrote in message
news:OJYC$WQNFHA.688@.TK2MSFTNGP10.phx.gbl...
> There are many such string. I cannot use sql query for each to just make
it
> a upper case. Is there a way i can find out exact local the SQL Server is
> using or is there any documentation of which API UPPER function insql
uses.
> "John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
> news:E55039D7-F207-4131-AF23-4E603E29A38D@.microsoft.com...
> the
'Men'.
> I
> to .
> before
The
> target
> converting
I
> code
> and
>|||"Ajey" <ajey5@.hotmail.com> schrieb im Newsbeitrag =
news:OkTRS$ONFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I have a string which contains some german characters e.g =
'Men=FC'. I
> am converting it to upper case using wcsupr (). But =FC is not =
converted to =DC.
> There are other characters too. I can use the _wsetlocale () function =
before
> using _wcsupr (). I cannot use the current machines locale setting. =
The
> strings have to be converted to upper case based on the locale of the =
target
> machine which is a SQL Server. What's the most efficient way of =
converting
> the string to upper case considering the language specific characters. =
I
> tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM =
code
> page. This seems to be working. What's the difference in OEM code page =
and
> language specific code page?
wcsupr should be independent of the current locale. However, there seems =
to be a bug in the implementation of wcsupr. It first checks the current =
locale and if the "C" locale is used, it simply translates 'a'-'z' to =
upper case but ignores all other letters. If you select any locale =
different form the "C" locale, the string will be translated correctly. =
So, your call to setlocale does fix that bug, but using an OEM codepage =
might introduce other problems. Using the current ANSI codepage (".ACP") =
probably is a better choice.
If you are very cautions, you should implement your own to-upper =
function that selects a reasonable codepage and later restores the =
original one. Something like
void ToUpper(wchar_t* s)
{
char const* loc =3D setlocale(LC_CTYPE, ".ACP");
wcsupr(s);
setlocale(LC_CTYPE, loc);
}
As long as you feed unicode strings (wchar_t) to your SQL server, you =
shouldn't have to worry about locales. You only have to select some =
locale to fix that stupid bug of wcsupr.
HTH
Heinz|||Is the setting applicable to current thread only or to entire program (all
threads)?
"Heinz Ozwirk" <hozwirk.SPAM@.arcor.de> wrote in message
news:424a7cd4$0$11477$9b4e6d93@.newsread2
.arcor-online.net...
"Ajey" <ajey5@.hotmail.com> schrieb im Newsbeitrag
news:OkTRS$ONFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I have a string which contains some german characters e.g 'Men'. I
> am converting it to upper case using wcsupr (). But is not converted to
.
> There are other characters too. I can use the _wsetlocale () function
before
> using _wcsupr (). I cannot use the current machines locale setting. The
> strings have to be converted to upper case based on the locale of the
target
> machine which is a SQL Server. What's the most efficient way of converting
> the string to upper case considering the language specific characters. I
> tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM code
> page. This seems to be working. What's the difference in OEM code page and
> language specific code page?
wcsupr should be independent of the current locale. However, there seems to
be a bug in the implementation of wcsupr. It first checks the current locale
and if the "C" locale is used, it simply translates 'a'-'z' to upper case
but ignores all other letters. If you select any locale different form the
"C" locale, the string will be translated correctly. So, your call to
setlocale does fix that bug, but using an OEM codepage might introduce other
problems. Using the current ANSI codepage (".ACP") probably is a better
choice.
If you are very cautions, you should implement your own to-upper function
that selects a reasonable codepage and later restores the original one.
Something like
void ToUpper(wchar_t* s)
{
char const* loc = setlocale(LC_CTYPE, ".ACP");
wcsupr(s);
setlocale(LC_CTYPE, loc);
}
As long as you feed unicode strings (wchar_t) to your SQL server, you
shouldn't have to worry about locales. You only have to select some locale
to fix that stupid bug of wcsupr.
HTH
Heinz|||Hi
If you always require uppercase then you may think about changing the
data and adding contraints to make sure it is always in uppercase.
Changing you queries may actually be less work than changing the code
especially if you are using stored procedures.
John
Ajey wrote:
> There are many such string. I cannot use sql query for each to just
make it
> a upper case. Is there a way i can find out exact local the SQL
Server is
> using or is there any documentation of which API UPPER function insql
uses.
> "John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
> news:E55039D7-F207-4131-AF23-4E603E29A38D@.microsoft.com...
retrieving/saving
> the
'Men=FC'.
> I
converted
> to =DC.
function
> before
setting. The
the
> target
> converting
characters. I
OEM
> code
page
> and|||"Ajey" <ajey5@.hotmail.com> schrieb im Newsbeitrag =
news:e6a6QnRNFHA.3328@.TK2MSFTNGP14.phx.gbl...
> Is the setting applicable to current thread only or to entire program =
(all
> threads)?
The code looks like it should be thread specific. Give it a try...
HTH
Heinz

_wcsupr () with german characters

Hi,
I have a string which contains some german characters e.g 'Menü'. I
am converting it to upper case using wcsupr (). But ü is not converted to Ü.
There are other characters too. I can use the _wsetlocale () function before
using _wcsupr (). I cannot use the current machines locale setting. The
strings have to be converted to upper case based on the locale of the target
machine which is a SQL Server. What's the most efficient way of converting
the string to upper case considering the language specific characters. I
tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM code
page. This seems to be working. What's the difference in OEM code page and
language specific code page?
Thanks in advance
AjeyHi
The easiest way may be to use the UPPER function when retrieving/saving the
data
SELECT UPPER( 'Menü')
--
MENÃ?
John
"Ajey" wrote:
> Hi,
> I have a string which contains some german characters e.g 'Menü'. I
> am converting it to upper case using wcsupr (). But ü is not converted to �.
> There are other characters too. I can use the _wsetlocale () function before
> using _wcsupr (). I cannot use the current machines locale setting. The
> strings have to be converted to upper case based on the locale of the target
> machine which is a SQL Server. What's the most efficient way of converting
> the string to upper case considering the language specific characters. I
> tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM code
> page. This seems to be working. What's the difference in OEM code page and
> language specific code page?
> Thanks in advance
> Ajey
>
>|||There are many such string. I cannot use sql query for each to just make it
a upper case. Is there a way i can find out exact local the SQL Server is
using or is there any documentation of which API UPPER function insql uses.
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
news:E55039D7-F207-4131-AF23-4E603E29A38D@.microsoft.com...
> Hi
> The easiest way may be to use the UPPER function when retrieving/saving
the
> data
> SELECT UPPER( 'Menü')
> --
> MENÜ
> John
> "Ajey" wrote:
> > Hi,
> > I have a string which contains some german characters e.g 'Menü'.
I
> > am converting it to upper case using wcsupr (). But ü is not converted
to Ü.
> > There are other characters too. I can use the _wsetlocale () function
before
> > using _wcsupr (). I cannot use the current machines locale setting. The
> > strings have to be converted to upper case based on the locale of the
target
> > machine which is a SQL Server. What's the most efficient way of
converting
> > the string to upper case considering the language specific characters. I
> > tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM
code
> > page. This seems to be working. What's the difference in OEM code page
and
> > language specific code page?
> >
> > Thanks in advance
> >
> > Ajey
> >
> >
> >
> >|||If i get the code page from the SQL Server as 1252 where as the language on
server is german but the machine where i am running the API has English,
will _wsetlocale(LC_CTYPE, L".1252") work fine. Are code page number specifc
to languages or they cover range of languages. (I want to make sure that
code page 1252 is not different for german and different for english)
"Ajey" <ajey5@.hotmail.com> wrote in message
news:OJYC$WQNFHA.688@.TK2MSFTNGP10.phx.gbl...
> There are many such string. I cannot use sql query for each to just make
it
> a upper case. Is there a way i can find out exact local the SQL Server is
> using or is there any documentation of which API UPPER function insql
uses.
> "John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
> news:E55039D7-F207-4131-AF23-4E603E29A38D@.microsoft.com...
> > Hi
> >
> > The easiest way may be to use the UPPER function when retrieving/saving
> the
> > data
> >
> > SELECT UPPER( 'Menü')
> >
> > --
> > MENÜ
> >
> > John
> >
> > "Ajey" wrote:
> >
> > > Hi,
> > > I have a string which contains some german characters e.g
'Menü'.
> I
> > > am converting it to upper case using wcsupr (). But ü is not converted
> to Ü.
> > > There are other characters too. I can use the _wsetlocale () function
> before
> > > using _wcsupr (). I cannot use the current machines locale setting.
The
> > > strings have to be converted to upper case based on the locale of the
> target
> > > machine which is a SQL Server. What's the most efficient way of
> converting
> > > the string to upper case considering the language specific characters.
I
> > > tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM
> code
> > > page. This seems to be working. What's the difference in OEM code page
> and
> > > language specific code page?
> > >
> > > Thanks in advance
> > >
> > > Ajey
> > >
> > >
> > >
> > >
>|||"Ajey" <ajey5@.hotmail.com> schrieb im Newsbeitrag =news:OkTRS$ONFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I have a string which contains some german characters e.g ='Men=FC'. I
> am converting it to upper case using wcsupr (). But =FC is not =converted to =DC.
> There are other characters too. I can use the _wsetlocale () function =before
> using _wcsupr (). I cannot use the current machines locale setting. =The
> strings have to be converted to upper case based on the locale of the =target
> machine which is a SQL Server. What's the most efficient way of =converting
> the string to upper case considering the language specific characters. =I
> tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM =code
> page. This seems to be working. What's the difference in OEM code page =and
> language specific code page?
wcsupr should be independent of the current locale. However, there seems =to be a bug in the implementation of wcsupr. It first checks the current =locale and if the "C" locale is used, it simply translates 'a'-'z' to =upper case but ignores all other letters. If you select any locale =different form the "C" locale, the string will be translated correctly. =So, your call to setlocale does fix that bug, but using an OEM codepage =might introduce other problems. Using the current ANSI codepage (".ACP") =probably is a better choice.
If you are very cautions, you should implement your own to-upper =function that selects a reasonable codepage and later restores the =original one. Something like
void ToUpper(wchar_t* s)
{
char const* loc =3D setlocale(LC_CTYPE, ".ACP");
wcsupr(s);
setlocale(LC_CTYPE, loc);
}
As long as you feed unicode strings (wchar_t) to your SQL server, you =shouldn't have to worry about locales. You only have to select some =locale to fix that stupid bug of wcsupr.
HTH
Heinz|||Is the setting applicable to current thread only or to entire program (all
threads)?
"Heinz Ozwirk" <hozwirk.SPAM@.arcor.de> wrote in message
news:424a7cd4$0$11477$9b4e6d93@.newsread2.arcor-online.net...
"Ajey" <ajey5@.hotmail.com> schrieb im Newsbeitrag
news:OkTRS$ONFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I have a string which contains some german characters e.g 'Menü'. I
> am converting it to upper case using wcsupr (). But ü is not converted to
Ü.
> There are other characters too. I can use the _wsetlocale () function
before
> using _wcsupr (). I cannot use the current machines locale setting. The
> strings have to be converted to upper case based on the locale of the
target
> machine which is a SQL Server. What's the most efficient way of converting
> the string to upper case considering the language specific characters. I
> tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM code
> page. This seems to be working. What's the difference in OEM code page and
> language specific code page?
wcsupr should be independent of the current locale. However, there seems to
be a bug in the implementation of wcsupr. It first checks the current locale
and if the "C" locale is used, it simply translates 'a'-'z' to upper case
but ignores all other letters. If you select any locale different form the
"C" locale, the string will be translated correctly. So, your call to
setlocale does fix that bug, but using an OEM codepage might introduce other
problems. Using the current ANSI codepage (".ACP") probably is a better
choice.
If you are very cautions, you should implement your own to-upper function
that selects a reasonable codepage and later restores the original one.
Something like
void ToUpper(wchar_t* s)
{
char const* loc = setlocale(LC_CTYPE, ".ACP");
wcsupr(s);
setlocale(LC_CTYPE, loc);
}
As long as you feed unicode strings (wchar_t) to your SQL server, you
shouldn't have to worry about locales. You only have to select some locale
to fix that stupid bug of wcsupr.
HTH
Heinz|||Hi
If you always require uppercase then you may think about changing the
data and adding contraints to make sure it is always in uppercase.
Changing you queries may actually be less work than changing the code
especially if you are using stored procedures.
John
Ajey wrote:
> There are many such string. I cannot use sql query for each to just
make it
> a upper case. Is there a way i can find out exact local the SQL
Server is
> using or is there any documentation of which API UPPER function insql
uses.
> "John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
> news:E55039D7-F207-4131-AF23-4E603E29A38D@.microsoft.com...
> > Hi
> >
> > The easiest way may be to use the UPPER function when
retrieving/saving
> the
> > data
> >
> > SELECT UPPER( 'Men=FC')
> >
> > --
> > MEN=DC
> >
> > John
> >
> > "Ajey" wrote:
> >
> > > Hi,
> > > I have a string which contains some german characters e.g
'Men=FC'.
> I
> > > am converting it to upper case using wcsupr (). But =FC is not
converted
> to =DC.
> > > There are other characters too. I can use the _wsetlocale ()
function
> before
> > > using _wcsupr (). I cannot use the current machines locale
setting. The
> > > strings have to be converted to upper case based on the locale of
the
> target
> > > machine which is a SQL Server. What's the most efficient way of
> converting
> > > the string to upper case considering the language specific
characters. I
> > > tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the
OEM
> code
> > > page. This seems to be working. What's the difference in OEM code
page
> and
> > > language specific code page?
> > >
> > > Thanks in advance
> > >
> > > Ajey
> > >
> > >
> > >
> > >|||"Ajey" <ajey5@.hotmail.com> schrieb im Newsbeitrag =news:e6a6QnRNFHA.3328@.TK2MSFTNGP14.phx.gbl...
> Is the setting applicable to current thread only or to entire program =(all
> threads)?
The code looks like it should be thread specific. Give it a try...
HTH
Heinz

_wcsupr () with german characters

Hi,
I have a string which contains some german characters e.g 'Men'. I
am converting it to upper case using wcsupr (). But is not converted to .
There are other characters too. I can use the _wsetlocale () function before
using _wcsupr (). I cannot use the current machines locale setting. The
strings have to be converted to upper case based on the locale of the target
machine which is a SQL Server. What's the most efficient way of converting
the string to upper case considering the language specific characters. I
tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM code
page. This seems to be working. What's the difference in OEM code page and
language specific code page?
Thanks in advance
AjeyHi
The easiest way may be to use the UPPER function when retrieving/saving the
data
SELECT UPPER( 'Menü')
MENü
John
"Ajey" wrote:

> Hi,
> I have a string which contains some german characters e.g 'Menü'.
I
> am converting it to upper case using wcsupr (). But ü is not converted to
ü.
> There are other characters too. I can use the _wsetlocale () function befo
re
> using _wcsupr (). I cannot use the current machines locale setting. The
> strings have to be converted to upper case based on the locale of the targ
et
> machine which is a SQL Server. What's the most efficient way of converting
> the string to upper case considering the language specific characters. I
> tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM code
> page. This seems to be working. What's the difference in OEM code page and
> language specific code page?
> Thanks in advance
> Ajey
>
>|||There are many such string. I cannot use sql query for each to just make it
a upper case. Is there a way i can find out exact local the SQL Server is
using or is there any documentation of which API UPPER function insql uses.
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
news:E55039D7-F207-4131-AF23-4E603E29A38D@.microsoft.com...
> Hi
> The easiest way may be to use the UPPER function when retrieving/saving
the[vbcol=seagreen]
> data
> SELECT UPPER( 'Men')
> --
> MEN
> John
> "Ajey" wrote:
>
I[vbcol=seagreen]
to .[vbcol=seagreen]
before[vbcol=seagreen]
target[vbcol=seagreen]
converting[vbcol=seagreen]
code[vbcol=seagreen]
and[vbcol=seagreen]|||If i get the code page from the SQL Server as 1252 where as the language on
server is german but the machine where i am running the API has English,
will _wsetlocale(LC_CTYPE, L".1252") work fine. Are code page number specifc
to languages or they cover range of languages. (I want to make sure that
code page 1252 is not different for german and different for english)
"Ajey" <ajey5@.hotmail.com> wrote in message
news:OJYC$WQNFHA.688@.TK2MSFTNGP10.phx.gbl...
> There are many such string. I cannot use sql query for each to just make
it
> a upper case. Is there a way i can find out exact local the SQL Server is
> using or is there any documentation of which API UPPER function insql
uses.
> "John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
> news:E55039D7-F207-4131-AF23-4E603E29A38D@.microsoft.com...
> the
'Men'.[vbcol=seagreen]
> I
> to .
> before
The[vbcol=seagreen]
> target
> converting
I[vbcol=seagreen]
> code
> and
>|||"Ajey" <ajey5@.hotmail.com> schrieb im Newsbeitrag =
news:OkTRS$ONFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I have a string which contains some german characters e.g =
'Men=FC'. I
> am converting it to upper case using wcsupr (). But =FC is not =
converted to =DC.
> There are other characters too. I can use the _wsetlocale () function =
before
> using _wcsupr (). I cannot use the current machines locale setting. =
The
> strings have to be converted to upper case based on the locale of the =
target
> machine which is a SQL Server. What's the most efficient way of =
converting
> the string to upper case considering the language specific characters. =
I
> tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM =
code
> page. This seems to be working. What's the difference in OEM code page =
and
> language specific code page?
wcsupr should be independent of the current locale. However, there seems =
to be a bug in the implementation of wcsupr. It first checks the current =
locale and if the "C" locale is used, it simply translates 'a'-'z' to =
upper case but ignores all other letters. If you select any locale =
different form the "C" locale, the string will be translated correctly. =
So, your call to setlocale does fix that bug, but using an OEM codepage =
might introduce other problems. Using the current ANSI codepage (".ACP") =
probably is a better choice.
If you are very cautions, you should implement your own to-upper =
function that selects a reasonable codepage and later restores the =
original one. Something like
void ToUpper(wchar_t* s)
{
char const* loc =3D setlocale(LC_CTYPE, ".ACP");
wcsupr(s);
setlocale(LC_CTYPE, loc);
}
As long as you feed unicode strings (wchar_t) to your SQL server, you =
shouldn't have to worry about locales. You only have to select some =
locale to fix that stupid bug of wcsupr.
HTH
Heinz|||Is the setting applicable to current thread only or to entire program (all
threads)?
"Heinz Ozwirk" <hozwirk.SPAM@.arcor.de> wrote in message
news:424a7cd4$0$11477$9b4e6d93@.newsread2
.arcor-online.net...
"Ajey" <ajey5@.hotmail.com> schrieb im Newsbeitrag
news:OkTRS$ONFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I have a string which contains some german characters e.g 'Men'. I
> am converting it to upper case using wcsupr (). But is not converted to
.
> There are other characters too. I can use the _wsetlocale () function
before
> using _wcsupr (). I cannot use the current machines locale setting. The
> strings have to be converted to upper case based on the locale of the
target
> machine which is a SQL Server. What's the most efficient way of converting
> the string to upper case considering the language specific characters. I
> tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM code
> page. This seems to be working. What's the difference in OEM code page and
> language specific code page?
wcsupr should be independent of the current locale. However, there seems to
be a bug in the implementation of wcsupr. It first checks the current locale
and if the "C" locale is used, it simply translates 'a'-'z' to upper case
but ignores all other letters. If you select any locale different form the
"C" locale, the string will be translated correctly. So, your call to
setlocale does fix that bug, but using an OEM codepage might introduce other
problems. Using the current ANSI codepage (".ACP") probably is a better
choice.
If you are very cautions, you should implement your own to-upper function
that selects a reasonable codepage and later restores the original one.
Something like
void ToUpper(wchar_t* s)
{
char const* loc = setlocale(LC_CTYPE, ".ACP");
wcsupr(s);
setlocale(LC_CTYPE, loc);
}
As long as you feed unicode strings (wchar_t) to your SQL server, you
shouldn't have to worry about locales. You only have to select some locale
to fix that stupid bug of wcsupr.
HTH
Heinz|||Hi
If you always require uppercase then you may think about changing the
data and adding contraints to make sure it is always in uppercase.
Changing you queries may actually be less work than changing the code
especially if you are using stored procedures.
John
Ajey wrote:
> There are many such string. I cannot use sql query for each to just
make it
> a upper case. Is there a way i can find out exact local the SQL
Server is
> using or is there any documentation of which API UPPER function insql
uses.[vbcol=seagreen]
> "John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
> news:E55039D7-F207-4131-AF23-4E603E29A38D@.microsoft.com...
retrieving/saving[vbcol=seagreen]
> the
'Men=FC'.[vbcol=seagreen]
> I
converted[vbcol=seagreen]
> to =DC.
function[vbcol=seagreen]
> before
setting. The[vbcol=seagreen]
the[vbcol=seagreen]
> target
> converting
characters. I[vbcol=seagreen]
OEM[vbcol=seagreen]
> code
page[vbcol=seagreen]
> and|||"Ajey" <ajey5@.hotmail.com> schrieb im Newsbeitrag =
news:e6a6QnRNFHA.3328@.TK2MSFTNGP14.phx.gbl...
> Is the setting applicable to current thread only or to entire program =
(all
> threads)?
The code looks like it should be thread specific. Give it a try...
HTH
Heinz

_wcsupr () with german characters

Hi,
I have a string which contains some german characters e.g 'Men'. I
am converting it to upper case using wcsupr (). But is not converted to .
There are other characters too. I can use the _wsetlocale () function before
using _wcsupr (). I cannot use the current machines locale setting. The
strings have to be converted to upper case based on the locale of the target
machine which is a SQL Server. What's the most efficient way of converting
the string to upper case considering the language specific characters. I
tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM code
page. This seems to be working. What's the difference in OEM code page and
language specific code page?
Thanks in advance
Ajey
Hi
The easiest way may be to use the UPPER function when retrieving/saving the
data
SELECT UPPER( 'Menü')
MENü
John
"Ajey" wrote:

> Hi,
> I have a string which contains some german characters e.g 'Menü'. I
> am converting it to upper case using wcsupr (). But ü is not converted to ü.
> There are other characters too. I can use the _wsetlocale () function before
> using _wcsupr (). I cannot use the current machines locale setting. The
> strings have to be converted to upper case based on the locale of the target
> machine which is a SQL Server. What's the most efficient way of converting
> the string to upper case considering the language specific characters. I
> tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM code
> page. This seems to be working. What's the difference in OEM code page and
> language specific code page?
> Thanks in advance
> Ajey
>
>
|||There are many such string. I cannot use sql query for each to just make it
a upper case. Is there a way i can find out exact local the SQL Server is
using or is there any documentation of which API UPPER function insql uses.
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
news:E55039D7-F207-4131-AF23-4E603E29A38D@.microsoft.com...
> Hi
> The easiest way may be to use the UPPER function when retrieving/saving
the[vbcol=seagreen]
> data
> SELECT UPPER( 'Men')
> --
> MEN
> John
> "Ajey" wrote:
I[vbcol=seagreen]
to .[vbcol=seagreen]
before[vbcol=seagreen]
target[vbcol=seagreen]
converting[vbcol=seagreen]
code[vbcol=seagreen]
and[vbcol=seagreen]
|||If i get the code page from the SQL Server as 1252 where as the language on
server is german but the machine where i am running the API has English,
will _wsetlocale(LC_CTYPE, L".1252") work fine. Are code page number specifc
to languages or they cover range of languages. (I want to make sure that
code page 1252 is not different for german and different for english)
"Ajey" <ajey5@.hotmail.com> wrote in message
news:OJYC$WQNFHA.688@.TK2MSFTNGP10.phx.gbl...
> There are many such string. I cannot use sql query for each to just make
it
> a upper case. Is there a way i can find out exact local the SQL Server is
> using or is there any documentation of which API UPPER function insql
uses.[vbcol=seagreen]
> "John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
> news:E55039D7-F207-4131-AF23-4E603E29A38D@.microsoft.com...
> the
'Men'.[vbcol=seagreen]
> I
> to .
> before
The[vbcol=seagreen]
> target
> converting
I
> code
> and
>
|||"Ajey" <ajey5@.hotmail.com> schrieb im Newsbeitrag =
news:OkTRS$ONFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I have a string which contains some german characters e.g =
'Men=FC'. I
> am converting it to upper case using wcsupr (). But =FC is not =
converted to =DC.
> There are other characters too. I can use the _wsetlocale () function =
before
> using _wcsupr (). I cannot use the current machines locale setting. =
The
> strings have to be converted to upper case based on the locale of the =
target
> machine which is a SQL Server. What's the most efficient way of =
converting
> the string to upper case considering the language specific characters. =
I
> tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM =
code
> page. This seems to be working. What's the difference in OEM code page =
and
> language specific code page?
wcsupr should be independent of the current locale. However, there seems =
to be a bug in the implementation of wcsupr. It first checks the current =
locale and if the "C" locale is used, it simply translates 'a'-'z' to =
upper case but ignores all other letters. If you select any locale =
different form the "C" locale, the string will be translated correctly. =
So, your call to setlocale does fix that bug, but using an OEM codepage =
might introduce other problems. Using the current ANSI codepage (".ACP") =
probably is a better choice.
If you are very cautions, you should implement your own to-upper =
function that selects a reasonable codepage and later restores the =
original one. Something like
void ToUpper(wchar_t* s)
{
char const* loc =3D setlocale(LC_CTYPE, ".ACP");
wcsupr(s);
setlocale(LC_CTYPE, loc);
}
As long as you feed unicode strings (wchar_t) to your SQL server, you =
shouldn't have to worry about locales. You only have to select some =
locale to fix that stupid bug of wcsupr.
HTH
Heinz
|||Is the setting applicable to current thread only or to entire program (all
threads)?
"Heinz Ozwirk" <hozwirk.SPAM@.arcor.de> wrote in message
news:424a7cd4$0$11477$9b4e6d93@.newsread2.arcor-online.net...
"Ajey" <ajey5@.hotmail.com> schrieb im Newsbeitrag
news:OkTRS$ONFHA.1528@.TK2MSFTNGP09.phx.gbl...
> Hi,
> I have a string which contains some german characters e.g 'Men'. I
> am converting it to upper case using wcsupr (). But is not converted to
.
> There are other characters too. I can use the _wsetlocale () function
before
> using _wcsupr (). I cannot use the current machines locale setting. The
> strings have to be converted to upper case based on the locale of the
target
> machine which is a SQL Server. What's the most efficient way of converting
> the string to upper case considering the language specific characters. I
> tried using the _wsetlocale (LC_CTYPE , L".OCP"); which uses the OEM code
> page. This seems to be working. What's the difference in OEM code page and
> language specific code page?
wcsupr should be independent of the current locale. However, there seems to
be a bug in the implementation of wcsupr. It first checks the current locale
and if the "C" locale is used, it simply translates 'a'-'z' to upper case
but ignores all other letters. If you select any locale different form the
"C" locale, the string will be translated correctly. So, your call to
setlocale does fix that bug, but using an OEM codepage might introduce other
problems. Using the current ANSI codepage (".ACP") probably is a better
choice.
If you are very cautions, you should implement your own to-upper function
that selects a reasonable codepage and later restores the original one.
Something like
void ToUpper(wchar_t* s)
{
char const* loc = setlocale(LC_CTYPE, ".ACP");
wcsupr(s);
setlocale(LC_CTYPE, loc);
}
As long as you feed unicode strings (wchar_t) to your SQL server, you
shouldn't have to worry about locales. You only have to select some locale
to fix that stupid bug of wcsupr.
HTH
Heinz
|||Hi
If you always require uppercase then you may think about changing the
data and adding contraints to make sure it is always in uppercase.
Changing you queries may actually be less work than changing the code
especially if you are using stored procedures.
John
Ajey wrote:
> There are many such string. I cannot use sql query for each to just
make it
> a upper case. Is there a way i can find out exact local the SQL
Server is
> using or is there any documentation of which API UPPER function insql
uses.[vbcol=seagreen]
> "John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
> news:E55039D7-F207-4131-AF23-4E603E29A38D@.microsoft.com...
retrieving/saving[vbcol=seagreen]
> the
'Men=FC'.[vbcol=seagreen]
> I
converted[vbcol=seagreen]
> to =DC.
function[vbcol=seagreen]
> before
setting. The[vbcol=seagreen]
the[vbcol=seagreen]
> target
> converting
characters. I[vbcol=seagreen]
OEM[vbcol=seagreen]
> code
page[vbcol=seagreen]
> and
|||"Ajey" <ajey5@.hotmail.com> schrieb im Newsbeitrag =
news:e6a6QnRNFHA.3328@.TK2MSFTNGP14.phx.gbl...
> Is the setting applicable to current thread only or to entire program =
(all
> threads)?
The code looks like it should be thread specific. Give it a try...
HTH
Heinz
sql

Monday, March 19, 2012

[SQL2000] Transactional replication and database filegroups

Hello everybory
Some general question about Transactionnal Replication features on SQL 2000
In case of using Trans. Repl. to duplicate a whole database to another SQL
2000 server, does the Transactionnal Replication preserve database's
filegroup (i.e. tables/indexes distributed accross different files on disk ) ?
No info found about it in the BOL or KB.
I have made some testings and even when the destination database is created
with multiple filegroups before transactionnal replicatiion activated, all
the tables fall in the PRIMARY filegroupn whatever their initial filegroup in
the source database.
Any option or hints to do this ?
Thank in advance
Jb,
you could script out the creation of filegroups and creation of objects onto
particular filegroups. On the publication properties, this script could be
made to run before the snapshot is applied. On the article properties,
naming conflicts section, you can select to leave the table intact if it
already exists. This bypasses the inbuilt snapshot schema generation.
HTH,
Paul Ibison
"Jb Vernejoux" <JbVernejoux@.discussions.microsoft.com> wrote in message
news:AB06D8F0-1CB8-4E44-AC66-FEBC5311CD8C@.microsoft.com...
> Hello everybory
> Some general question about Transactionnal Replication features on SQL
2000
> In case of using Trans. Repl. to duplicate a whole database to another SQL
> 2000 server, does the Transactionnal Replication preserve database's
> filegroup (i.e. tables/indexes distributed accross different files on
disk ) ?
> No info found about it in the BOL or KB.
> I have made some testings and even when the destination database is
created
> with multiple filegroups before transactionnal replicatiion activated, all
> the tables fall in the PRIMARY filegroupn whatever their initial filegroup
in
> the source database.
> Any option or hints to do this ?
> Thank in advance
|||use a pre snapshot command that adds the file groups. (Alter database test
add filegroup file_group).
and then add some files to this filegroup
ALTER DATABASE test
ADD FILE(NAME = 'test_FG', FILENAME = 'C:\temp\test_FG_Data.NDF', SIZE = 1,
FILEGROWTH = 10%) TO FILEGROUP [test]
Hilary Cotter
Looking for a book on SQL Server replication?
http://www.nwsu.com/0974973602.html
"Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
news:uuKyWTciEHA.2664@.TK2MSFTNGP11.phx.gbl...
> Jb,
> you could script out the creation of filegroups and creation of objects
onto[vbcol=seagreen]
> particular filegroups. On the publication properties, this script could be
> made to run before the snapshot is applied. On the article properties,
> naming conflicts section, you can select to leave the table intact if it
> already exists. This bypasses the inbuilt snapshot schema generation.
> HTH,
> Paul Ibison
> "Jb Vernejoux" <JbVernejoux@.discussions.microsoft.com> wrote in message
> news:AB06D8F0-1CB8-4E44-AC66-FEBC5311CD8C@.microsoft.com...
> 2000
SQL[vbcol=seagreen]
> disk ) ?
> created
all[vbcol=seagreen]
filegroup
> in
>
|||ok,
thanks all for your info
Jb VERNEJOUX
"Hilary Cotter" wrote:

> use a pre snapshot command that adds the file groups. (Alter database test
> add filegroup file_group).
> and then add some files to this filegroup
> ALTER DATABASE test
> ADD FILE(NAME = 'test_FG', FILENAME = 'C:\temp\test_FG_Data.NDF', SIZE = 1,
> FILEGROWTH = 10%) TO FILEGROUP [test]
> --
> Hilary Cotter
> Looking for a book on SQL Server replication?
> http://www.nwsu.com/0974973602.html
>
> "Paul Ibison" <Paul.Ibison@.Pygmalion.Com> wrote in message
> news:uuKyWTciEHA.2664@.TK2MSFTNGP11.phx.gbl...
> onto
> SQL
> all
> filegroup
>
>

Thursday, February 16, 2012

[ask] how to invoke sqldatasource command in method?

hello everybody, i have a question to ask,

suppose i have a sqldatasource, can i use it in a method??

this is my case, i need to make a new method to count the rows in a datagrid, so i will have to read the sqldatasource. the problem is, how to retrieve it?? usually i use the built in sqldatasource_selected to count the rows...

is there any other way??

Lets have a binddata method

privatevoid BindData()

{

SqlDataSource1.SelectCommand =

"Select * from clients";

}

Call the above method in PageLoad or any other desired Event

In theSqlDataSource1_Selected

retrive the total rows

protectedvoid SqlDataSource1_Selected(object sender,SqlDataSourceStatusEventArgs e)

{

Label1.Text = e.AffectedRows.ToString();

}

Hope this will help you.

let me know if need further clarifications

|||

yupz i know that, but that doesn't solve my problem

if i save the total row to a variable, let's say countRow = e.AffectedRows, how can i pass this value to another method??

(i need this value to be added by 1 so i can use it for the next primary key)

|||

Store it in a Viewstate or Session Variable

Set Value

Session[

"RowCount"] = e.AffectedRows;

ViewState[

"RowCount"] = e.AffectedRows;

Getvalue

int rowCount1 =int.Parse(Session["RowCount"].ToString());

int rowCount2 =int.Parse(ViewState["RowCount"].ToString());

If you need to access the value even in otherpage use Session or Viewstate itself ok

|||

oww yes, session variable...i completely forget it :)

thx so much bro...

but that viewstate variable...what is the difference??

btw thx so much bro

|||

The values stored in session will be available through out the Session of a particular user irrespective of the page he/she is navigating.

Value stored in viewstate will be available only in the page in which it have been set.

More over in Viewstate you can place only string ,in Session variable you can place any object

Have a look into these links

http://hiltong.blogspot.com/2004/11/viewstate-vs-session-state-vs.html

http://aspalliance.com/articleViewer.aspx?aId=135&pId=

Hope this will help you

|||well...thank you very much bro

[ask] how to append string to the previous select statement bounded to gridview

i have a case :

i'm using a select statement with SqlCommand and save the results in the SQLDataAdapter

and using the data table I post the result to the gridview and show it there...

my question is what should I do to append string to the SQL Command??

I'm not sure if I understand what you're asking. Can you use something like this

SqlCommand.CommandText &=" appended text "

before executing the command?

|||

yes i need the command text to be appended with some text later

thanks anyway, i think it's better to try it first :)