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: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: insertion into database using script
Date: Apr 24 2000 2:26PM

venkat Reddy writes:
 > 
 > hi,
 > 
 >   How do I insert,update the tables?
 >   Below is the script I wrote.
 > 
 >   use Sybase::DBlib;
 > 
 > $pwd = "";
 > $server = "srvr01";
 > $database = "tempdb";
 > $dbh = new Sybase::DBlib 'sa', $pwd, $server,$database;
 > 
 > $dbh->dbcmd("insert into Users(Name,Sex) values(\"Venkat\",\"M\")");
 > $dbh->dbsqlexec;
 > $status=$dbh->dbresults;
 > 
 > print "The status is returned as == $status\n";
 > 
 > ----
 > the following are the errors I got:
 > 
 > Users not found. Specify owner.objectname or use sp_help to check whether the object exists (sp_help may produce lots of output).
 > DB-Library error:
 > 	General SQL Server error: Check messages from the SQL Server.

You're not in the correct database. You either need to use dbuse() to
"use" the right database, or prefix the User table with the database
qualifier:

"insert into $database..Users(...) values(...)"

Michael
-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler@peppler.org    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com