Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BUG: sp and conditional temp table
Message
 
 
À
23/05/2005 11:45:06
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
01016662
Message ID:
01016814
Vues:
9
Fabio,

>... it Will have to exist ????

Yes, why on earth would you want to insert into something that doesn't exist? Since you didn't do a create table command inside the SP I was assuming it had been created by the caller and will be populated by the called SP.

Are you intending to create the #temptable inside the test1 SP? If so it'll go out of scope and disappear once the execution of test1 finishes so there's no point to your code as posted. If you issue a create table #temptable inside the SP and insert into it like my code does it'll work fine.

>With two different names the sp go into the db,
>with the same name SQL fire a error:
>
>CREATE	PROCEDURE dbo.test1
>	@choice bit = 0
>as
>	if @choice=0
>		SELECT 1 x INTO #TEMPTABLE
>	else
>		SELECT 0 x INTO #TEMPTABLE1
>
>
>
>> But anyway this code compiles and executes without error:
>>
>>
>>CREATE	PROCEDURE dbo.test1
>>	@choice bit = 0
>>as
>>	if @choice=0
>>		insert into #temptable SELECT 1 x
>>	else
>>		insert into #temptable SELECT 0 x
>>
>>
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform