Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP SQL help (Oracle table with badly named columns)

Status
Not open for further replies.

baronmatthews

IS-IT--Management
Aug 24, 2004
15
US
I am cross posting the post below from the Oracle 8i group because someone in this group might have more experience with this particular problem...

OK, I am dealing with some tables I am inheriting that have column names with spaces (for instance ITEM NUMBER instead of ITEMNUM OR ITEMNUMBER OR ITEM_NUMBER, etc). I can't change the column names as there are too many dependencies that rely on the names. I can write in sqlplus, Access, etc, pretty much anything I need simply using tablename."column name" and that works fine.

My problem is when I am using ASP (classic ASP, not ASP.net) for a super simple report, I am unable to reference the columns with the spaces. If I wanted to say Item Number = xxx, it won't let me. I've tried every iteration I can think of, but I am not having any luck. I know the answer is looking me in the face, but alas, I am unable to see it right now. Any help would be great.
 
Never mind, it would be that the very next thing I tried after posting here worked!
 
It would be helpful to others with the same issue if you posted your solution.

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Good idea!!

OK, so, if you are using classic ASP and you have to deal with badly named columns that you can't change (i.e. mine had spaces -- Item Number -- and also other characters like -- Item #), you would run them in sqlplus like tablename."column name"... Well, that is what was giving me trouble in ASP. What I found was that you had to do tablename.""column name"" within your sql statement. I actually tried that once, but then I found that if do have to use double quotes, you have to take into mind what the case of the column name is. For instance, Item Number is not the same as item number or ITEM NUMBER. I have always made it a point to keep all my sql statements in caps (no reason, just how I started doing it). That was really throwing me off until I found a post about the case with double quotes. Hope this helps someone in the future.
 
baronmatthews,
thanks for posting your solution. this would help everyone.
cheers.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top