Tuesday, March 20, 2012
City, State expression problem!
the city and state are in one field and were in Upper case. I used the
strconv but I don't know how to make the state portion Upper instead or
Proper.
Right now the output looks like this: Birminham, Al
Any help is appreciated.Try the following:
select replace(ColName,right(ColName,1), Upper(right(ColName,1)))
Good Luck
swtjen01 wrote:
> I have a report which lists the city and state. The problem is that
> the city and state are in one field and were in Upper case. I used the
> strconv but I don't know how to make the state portion Upper instead or
> Proper.
> Right now the output looks like this: Birminham, Al
> Any help is appreciated.
Sunday, February 12, 2012
check value in table upper case or lower
hi
i want to select * from table1 where name =petter?
now if there is many type of petter in table linke PETTER ,Petter Andpetter which record will come in display?
if i want all this three (PETTER,Petter,petter) will come in display which command is for this ?
regard
It depends on the column collation(default the same as database) setting, which you can check usingsyscolumns. If you want to ignore case, you can change all data into UPPER (or LOWER) case:
DECLARE @.n1 varchar(20)
SELECT @.n1='petter'
SELECT * FROM testCol where UPPER(name)=UPPER(@.n1)
|||
Or you can specify the collation used in the SELECT command:
DECLARE @.n1 varchar(20)
SELECT @.n1='petter'
SELECT * FROM testCol wherename=@.n1
collate SQL_Latin1_General_CP1_CI_AS
You can get descriptions of SQL collations using this statement:
SELECT * FROM ::fn_helpcollations()
|||that was a good solution
but what it does
collate SQL_Latin1_General_CP1_CI_AS
any ideas
|||
This is used to specify collation used in the SELECT command. I choose SQL_Latin1_General_CP1_CI_AS because this collation is case insensitive (notice the CI). For more information, you can refer to:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_ca-co_5ell.asp