PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "WORENKLEIN, David, GCM" <David dot Worenklein at gcm dot com>
Subject: RE: using sybperl, how to insert data that contains a quote with in it
Date: Jan 5 2001 3:48PM

$data =~ s{'}{''}; # Replace a single quote with two single quotes (NOT a
double-quote)

-----Original Message-----
From: Klein, Shoshana R [mailto:Shoshana.Klein@gs.com]
Sent: Friday, January 05, 2001 10:45 AM
To: SybPerl Discussion List
Subject: using sybperl, how to insert data that contains a quote with in it

Below is my sql statement to insert data into a table.
the variable $in_name  contains on occasion a single quote  for example
john
o'brien.

I get back an sql error for the single quote
I've tried the following variations
anyone know how I can keep the value of the variable when it includes a
single quote




 my  $sql ="insert into amp_repos_user_app  values
                   ('$guid', '$in_aid',
                 '$in_name', '$in_login', '$in_second_login',
                  '$in_dept', '$in_user_dept_load_dt', '$upd_dtm')";




 my  $sql ="insert into amp_repos_user_app  values
                   ('$guid', '$in_aid',
                "$in_name", '$in_login', '$in_second_login',
                  '$in_dept', '$in_user_dept_load_dt', '$upd_dtm')";



my  $sql ="insert into amp_repos_user_app  values
                   ('$guid', '$in_aid',
                '"$in_name"', '$in_login', '$in_second_login',
                  '$in_dept', '$in_user_dept_load_dt', '$upd_dtm')";





    sql_query($login, $sql);                                   


**********************************************************************
This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.
************************************************************************