General information
Forum:
Microsoft SQL Server
Title:
Alter table command ignored, Why?
When this command runs as a stored proc it does not execute the alter table command before the insert command (although it works in Query Analyzer) as I still get an error about trying to insert a value into the primary key (docket_price_id (Indentity Column)). This proc is simply trying to copy a series of records from one docket_id to another within the same table.
Apparently this question was asked of Microsoft and they said that stored procs run differently then Query Analyzer, ya, thanks a lot, but with no
other help). I still need to make this work somehow...
CREATE PROCEDURE docket_copy_children
@docket_from_id INT,
@docket_to_id INT
AS
select * into #d1 from docket_prices where docket_id=@docket_from_id
update #d1 set docket_id=@docket_to_id
alter table #d1 drop column docket_price_id
insert into docket_prices select * from #d1
go
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only