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

  • 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]
1 Solution
Pratima PharandeCommented:

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

do not give '' whereever int
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 ...

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