Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

bad database field name

by mammynum (Initiate)
on Feb 11, 2004 at 19:57 UTC ( #328353=perlquestion: print w/replies, xml ) Need Help??

mammynum has asked for the wisdom of the Perl Monks concerning the following question:

I have a database field name that has a "/" in the name itself. There is a Select statement within a perl script that produces an error because of the front slash in the field name. My last resort is to rename the field but I wanted to see if I could use some sort of brackets, etc to not get this error. The field name is "ItemR/E".

Replies are listed 'Best First'.
Re: bad database field name
by monktim (Friar) on Feb 11, 2004 at 20:09 UTC
Re: bad database field name
by blue_cowdawg (Monsignor) on Feb 11, 2004 at 20:08 UTC

        There is a Select statement within a perl script that produces an error

    As I said to you in CB you need to show us a sample of your code in order for us to properly diagnose your problem. Without seeing what you have tried and had fail the best anymonk can do for you is a S.W.A.G.

    S.W.A.G. = Scientific Wild Assed Guess


    Peter L. Berghold -- Unix Professional
    Peter at Berghold dot Net
       Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice.
Re: bad database field name
by mammynum (Initiate) on Feb 11, 2004 at 20:12 UTC
    $QS = q{ SELECT po.POId2, i.cwdItemNum, i.ItemColor, i.size1, i.size2, i.size3, i.size4, i.size5, i.size6, i.size7, i.ItemDescription, i.ItemRetailCost, po.VendorNum, i.VenItemNum, i.itemCatCode, i.ItemLine, i.ItemR/E, i.ItemOurCost FROM tblPurchaseOrder po, tblPOItems i WHERE po.exportToDMMS=? AND i.itemPOID=po.POId2 ORDER BY i.itemPOID, i.sortNum};

    BazB added code tags

      To properly format that, please wrap your code in code tags. If you don't you could end up here Worst Nodes. There is a subset of HTML that monks are allowed to use. You can read about that here. Writeup Formatting Tips.

      You'll need to quote the column "i.ItemR/E" to get it to work. Like blue_cowdawg suggests, this is a SQL problem not a Perl one. If you cut the SQL code out and run it in isql or whatever SQL environment you use, you'll see that the dB Server doesn't understand the SQL. It can be difficult for a new Perl programmer to determine where the error is. Is it in the dB or is it in Perl? Please look at my earlier post and click in the link "Before asking a database related question". gmax has an excellent writeup about this. It will probably be a big help.

      Good luck and please go back and wrap your code in code tags.

      Your SQL looks wonderful. But what is the Perl error you are getting? What Perl code are you execting that is emitting an error?


      Peter L. Berghold -- Unix Professional
      Peter at Berghold dot Net
         Dog trainer, dog agility exhibitor, brewer of fine Belgian style ales. Happiness is a warm, tired, contented dog curled up at your side and a good Belgian ale in your chalice.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://328353]
Approved by flyingmoose
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2022-10-06 22:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred way to holiday/vacation is:











    Results (29 votes). Check out past polls.

    Notices?