Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Yet another SQL Question
Message
De
01/10/2012 09:13:04
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Divers
Thread ID:
01553897
Message ID:
01554036
Vues:
44
>>Hi all
>>
>>I want to crate a temp table based on a value passed to a stored procedure. Basically I'm trying to do this:
>>
>>If (some critera)
>>  select (field list) into #SubFile from CATMaster where (otherstuff)
>>else
>>  Select (field list) into #SubFile from CatMaster where (otherstuff, slightly different from the first)
>>
>>
>>It's giving me the red squiglly line under the 2nd #Subfile and telling me that one already exists in DB.
>>
>>What is the correct way to do what I want to do in SQL?
>
>If you want to create a temp table of the same structure when
>
>select fieldlist into #SubFile from ... where 1= 0
>
>if ...
>   insert into #SubFile
>   select  .... where
>else
>  insert into #SubFile
>  select ... where ...
I'll give this a try and let you know how it works out.
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform