Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Insert error

Author  Topic 

mukhan85
Starting Member

46 Posts

Posted - 2011-09-25 : 08:49:25
Hi, I'm trying to insert a record into the table with the following schema:

Column_name DataType Key
wkflw_activity_id numeric True
activity_name varchar False
wkflw_item_id numeric False
resp_party varchar False
assigned_to varchar False
action varchar False
comments varchar False
parent_activity_id numeric False
wkflw_name varchar False
start_date datetime False
end_date datetime False
due_date datetime False
created_by varchar False
created_time datetime False
modified_by varchar False
modified_time datetime False
wkflw_version varchar False


Query:
INSERT INTO tableName(activity_name, wkflw_item_id, action, comments, parent_activity_id, wkflw_name, start_date, end_date, due_date, created_by, created_time, modified_by, modified_time)
VALUES('New', 313396, NULL, NULL, 0, 'controls', '20110927 13:33:32.0', NULL, NULL, 'maks', '20110927 13:43:33.0', 'john', '20110927 13:33:32.0')
GO

Error
Implicit conversion from datatype 'NUMERIC' to 'VARCHAR' is not allowed. Use the CONVERT function to run this query.

The column wkflw_activity_id should be automatically generated.
Any suggestions?

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-25 : 13:04:34
if you want to generate wkflw_activity_id automatically, make it identity type and of integer type rather than numeric



------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

paultech
Yak Posting Veteran

79 Posts

Posted - 2011-09-27 : 09:54:04
May I suggest if you don't want it to be automatically generated, you can set a default value for it

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-09-27 : 11:34:00
quote:
Originally posted by paultech

May I suggest if you don't want it to be automatically generated, you can set a default value for it

paul Tech


how will you make sure its in sequence?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -