Solved

pipe & SQL

Posted on 2004-08-31
10
2,093 Views
Last Modified: 2008-02-01
I just found a nice little thing today (our DBA's didnt know about it either), you cant insert a pipe ( | ) directly with sql

ie

insert into tblMyTable ( myField ) values ( "|" )

so, easy enough to change it to chr(124) and everything works well.

My Q is,  How am i suposed to know that??  Is there some doc's / people know of what other things i cann't just go striaght out and add (of course " and ', but any other whacky ones )

Open for any input (on topic)! -

points for all!!!

Dave
0
Comment
Question by:flavo
  • 6
  • 3
10 Comments
 
LVL 10

Expert Comment

by:kiranghag
ID: 11948317
hi,
seems u have used double qoutes to delimit a string.
this is not allowed in ms-sql...double qoutes are used to name variable/columns which include space.
to enclose a string, u need to use single qoute  

i tried following command and it worked
insert into tblMyTable ( myField ) values ( '|' )

chr(124) refers to the ascii value of the character and that you can use anytime to refer any other character, not limited to special character

if u need to insert a single qoute itself, u need to insert two of them after each other...
e.g. '''' = a single qoute
0
 
LVL 34

Author Comment

by:flavo
ID: 11948340
opps.. Yeah i know that.

the SQL bit refers to MS Access general garden variety of SQL.. sorry for the mis-understanding.

What im really after is what else to i have to convert to Chr(int)???

I can do " and '

You could cay i kinda know how to use access, and  i am well aware of such issues... (see profile)
0
 
LVL 34

Author Comment

by:flavo
ID: 11948354
>> insert into tblMyTable ( myField ) values ( '|' )

Didn't seem to in Access 97
0
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 500 total points
ID: 11948404
Better explanation than I can provide:
http://support.microsoft.com/default.aspx?scid=kb;en-us;178070&Product=acc

Only the | character has this problem.
0
 
LVL 34

Author Comment

by:flavo
ID: 11948435
good enough for me!
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 34

Author Comment

by:flavo
ID: 11948438
you can goto sleep now shane
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 11948448
Not yet, I'm still working :(
0
 
LVL 34

Author Comment

by:flavo
ID: 11948475
It must be about 2:30am..
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 11948483
3:30am, to be precise, but I have a data conversion that must be done by 9AM tomorrow morning and the data only arrived at 9PM.....
0
 
LVL 34

Author Comment

by:flavo
ID: 11948574
crazy!  I did 13hrs yesterday, that's enough (way too much considering i work for the gevernment.. that's 3weeks worth of work in 1 day)...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now