[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1138
  • Last Modified:

Error while inserting into sybase database

Hi experts...
I am working with sybase ase and while inserting values into the sampTable  table i am getting the following error..
Please help...

Error Code: 257
SQL State: 42000
SQL: insert into  sampTable values ('99999','888881','6','ASDF','2011-04-28 07:48:01.249','SYSTEM','Y' )
Exception: com.sybase.jdbc2.jdbc.SybSQLException: Implicit conversion from datatype 'VARCHAR' to 'INT' is not allowed.  Use the CONVERT function to run this query.

The datatype of the table sampTable is:[int,int,,int,varchar,date,varchar,varchar]
0
gaugeta
Asked:
gaugeta
1 Solution
 
Pratima PharandeCommented:
try

insert into  sampTable values (99999,888881,6,'ASDF','2011-04-28 07:48:01.249','SYSTEM','Y' )

do not give '' whereever int
0
 
abbas_najafizadehCommented:
it's not recommended you use INSERT command without column list:
please use this syntax:
INSERT INTO table_name (colname1, colname2 , ....) values (val1,val2, ...);

instead of:
INSERT INTO table_name values (val1,val2, ...);

your used syntax is error prone, and might your values insert into table in another column names that has an invalid data-type ...
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now