INSERT INTO error (1 Viewer)

Ice Rhino

Registered User.
Local time
Today, 16:09
Joined
Jun 30, 2000
Messages
210
Greetings,

I have a INSERT sp that just copies a few lines from one table into another. The problem I am hitting is that one of the fields in the target table is an ID field (this is from when the table started its life in MS Access and used Autonumber). Obviously this field does not accept NULL values. How can I get the import process to automatically add the next sequential number in the ID field as part of this stored procedure?

USE [DashboardSQL-2K5]

GO

set ANSI_NULLS ON

set QUOTED_IDENTIFIER ON

GO

ALTER PROCEDURE [dbo].[spAppendDataDebtors]

AS INSERT INTO dbo.src_tbl_debt

(site_ref, estate_name, amount, src_date)

SELECT site_ref, estate_name, amount, src_date

FROM dbo.Debtors$

Thank you in advance:confused:
 

Ice Rhino

Registered User.
Local time
Today, 16:09
Joined
Jun 30, 2000
Messages
210
Think I might have solved this by leaving the field as an 'int' and set 'identity', 'identity seed', and 'identity increment'.

I hope that this works and will solve my issue.
 

Users who are viewing this thread

Top Bottom