Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 lowercase

Author  Topic 

mhg1063
Starting Member

27 Posts

Posted - 2004-03-30 : 12:55:29
Hello All
I have a few tables where the columns are mixed case. When creating a view if I'm selecting all the columns how can I use the lower function to get the columns lowercase, with out listing each individual column.
Ex. I don't want to do SELECT lower(loan_id),
lower(loan_amount)
FROM loan

I want to do something like SELECT lower(*) from loan.

Thanks in advance for any input.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-03-30 : 13:01:16
You can't do that.

Also you should NOT use SELECT *. You will receive a performance hit with SELECT *. In a SELECT, explicitly state which columns you want.

SELECT Column1, Column2
FROM Table1

So if you want LOWER:

SELECT LOWER(Column1), LOWER(Column2)
FROM Table1

Tara
Go to Top of Page

mhg1063
Starting Member

27 Posts

Posted - 2004-03-30 : 13:22:39
Thanks, its as I expected. If the table only has primary key constaints I could simply change all columns to lowercase with sql. I don't for see any problems converting the column names.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-03-30 : 13:59:13
I don't understand what you mean about primary key constraints. Using the LOWER function in a SELECT, just changes the display of the column. It does not change the data.

Tara
Go to Top of Page
   

- Advertisement -