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
 General SQL Server Forums
 New to SQL Server Programming
 Preservation of case

Author  Topic 

ConradK
Posting Yak Master

140 Posts

Posted - 2010-01-22 : 09:56:18
So when I have code like this

, data as 'CaSe SpEcIaL'

in my code, it spits out my data in a column named 'case special', instead of the case I designated. How fix?

Thanks alot guys!

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-01-22 : 10:03:13
in what code? sql, or front end? let's see the select
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-01-22 : 10:08:14
Use brackets, not quotes, for special column names.
, data as [CaSe SpEcIaL]



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

ConradK
Posting Yak Master

140 Posts

Posted - 2010-01-22 : 10:13:49
Its select sql. But I'm sure this brackets thing will work. Thanks alot guys.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-01-22 : 10:35:14
ahhh, i missed the AS
Go to Top of Page

ConradK
Posting Yak Master

140 Posts

Posted - 2010-01-22 : 10:36:07
hrmmm... didn't work. Exporting as CSV and still coming back with all lowercase...

Select

'VerifyAdd' as [*Action(SiteID=US|Country=US|Currency=USD|Version=403|CC=UTF-8)]
, p.productname as [*Title]

FROM Products p
INNER JOIN Products_Descriptions pd ON p.ProductID = pd.ProductID
INNER JOIN Products_Extended pe ON pd.ProductID = pe.ProductID
INNER JOIN Products_Memos pm ON p.ProductID = pm.ProductID

WHERE (p.IsChildOfProductCode is NULL OR p.IsChildOfProductCode = '')
AND (p.HideProduct is NULL OR p.HideProduct <> 'Y')
AND (pe.ProductCondition is NULL OR pe.ProductCondition <> 'Ammo')
AND (pe.Quickbooks_Item_Accnt is NULL OR pe.Quickbooks_Item_Accnt <> 'amazonflag')
AND (pe.ProductPrice > 0 AND pe.ProductPrice IS NOT NULL)
AND (pe.yahoo_medium IS NOT NULL)
AND (pe.EnableOptions_InventoryControl <> 'Y')
and (P.ProductCode not like '%[-][-]00%')
and (p.productname like '%la_er%')
ORDER BY p.ProductCode
Go to Top of Page

ConradK
Posting Yak Master

140 Posts

Posted - 2010-01-22 : 10:38:55
to be clear, the data in the columns is coming in the proper case, but the column headers themselves I need to be a certain case.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-01-22 : 12:02:54
I've never had a problem with column names being "as intended" ...

"Exporting as CSV "

How are you doing the Export?
Go to Top of Page

ConradK
Posting Yak Master

140 Posts

Posted - 2010-01-22 : 12:19:58
Its run through the backend of a website system called "Volusion". Its just not keeping the case of my column names. Its very frustrating.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-01-22 : 12:33:15
Do you think that could be mangling the column names?

I've seen lots of things that force "tolower(thingie)" or the like, over the years, and never understood why anyone would want to impose their will in that way.
Go to Top of Page

ConradK
Posting Yak Master

140 Posts

Posted - 2010-01-22 : 12:34:57
mangling? I do not know this term... Your saying you think the system itself is doing that above my code... not sure why ti would do that....
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-01-22 : 13:04:40
Yes, I think something in Volusion is doing it. Not SQL.
Go to Top of Page

ConradK
Posting Yak Master

140 Posts

Posted - 2010-01-22 : 14:12:23
alright. Thanks for your help. I guess I'll just have to implement a work around.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-01-22 : 14:16:06
Just before you do that ...

Might be worth trying the query, itself, from something else to prove that the column names are not fiddled-with. Its just possible that you are using a collation, or somesuch, where that happens (it will be news to me though!).

e.g. Query Analyser or SSMS
Go to Top of Page
   

- Advertisement -