Solved

pipe & SQL

Posted on 2004-08-31
10
2,089 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

759 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

22 Experts available now in Live!

Get 1:1 Help Now