Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alter table command ignored, Why?
Message
De
08/04/2002 10:41:37
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Alter table command ignored, Why?
Divers
Thread ID:
00642194
Message ID:
00642194
Vues:
70
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform