Click here to Skip to main content
15,917,059 members
Home / Discussions / Database
   

Database

 
AnswerRe: Cannot use temporary table twice Pin
Ennis Ray Lynch, Jr.23-Feb-09 8:08
Ennis Ray Lynch, Jr.23-Feb-09 8:08 
AnswerRe: Cannot use temporary table twice Pin
Wendelius23-Feb-09 8:40
mentorWendelius23-Feb-09 8:40 
GeneralRe: Cannot use temporary table twice Pin
MarcelloTurnbull23-Feb-09 8:46
MarcelloTurnbull23-Feb-09 8:46 
GeneralRe: Cannot use temporary table twice Pin
Wendelius23-Feb-09 8:49
mentorWendelius23-Feb-09 8:49 
GeneralRe: Cannot use temporary table twice Pin
MarcelloTurnbull23-Feb-09 9:08
MarcelloTurnbull23-Feb-09 9:08 
GeneralRe: Cannot use temporary table twice Pin
Wendelius23-Feb-09 9:14
mentorWendelius23-Feb-09 9:14 
GeneralRe: Cannot use temporary table twice Pin
MarcelloTurnbull23-Feb-09 9:29
MarcelloTurnbull23-Feb-09 9:29 
GeneralRe: Cannot use temporary table twice Pin
Wendelius23-Feb-09 9:47
mentorWendelius23-Feb-09 9:47 
That's odd. For some reason the parser interpets that the table is going to be created twice (of course that's not gonna happen since you have IF ... ELSE structure).

However, could you use the following:
DROP TABLE #Teste;
CREATE TABLE #Teste (
   IDField1 int
);
DECLARE @x int;
SET @x = 5;
IF (@x > 1)
BEGIN
   INSERT INTO #Teste
   SELECT IDField1
   FROM   Table1;
END;
ELSE 
BEGIN
   INSERT INTO #Teste
   SELECT IDField1
   FROM   Table1;
END;


The need to optimize rises from a bad design.My articles[^]

AnswerRe: Cannot use temporary table twice Pin
MarcelloTurnbull25-Feb-09 2:31
MarcelloTurnbull25-Feb-09 2:31 
GeneralRe: Cannot use temporary table twice Pin
Wendelius25-Feb-09 4:42
mentorWendelius25-Feb-09 4:42 
QuestionSQL 2000 Code/Update Deployment Pin
cjb11023-Feb-09 2:23
cjb11023-Feb-09 2:23 
AnswerRe: SQL 2000 Code/Update Deployment Pin
Wendelius23-Feb-09 8:45
mentorWendelius23-Feb-09 8:45 
QuestionSQL Server 2000: Login failed for user ' ' [modified] Pin
Nada Adel23-Feb-09 1:07
Nada Adel23-Feb-09 1:07 
AnswerRe: SQL Server 2000: Login failed for user ' ' Pin
Rob Philpott23-Feb-09 1:37
Rob Philpott23-Feb-09 1:37 
GeneralRe: SQL Server 2000: Login failed for user ' ' Pin
Nada Adel23-Feb-09 2:33
Nada Adel23-Feb-09 2:33 
GeneralRe: SQL Server 2000: Login failed for user ' ' Pin
Rob Philpott23-Feb-09 2:57
Rob Philpott23-Feb-09 2:57 
GeneralRe: SQL Server 2000: Login failed for user ' ' Pin
Nada Adel23-Feb-09 3:08
Nada Adel23-Feb-09 3:08 
QuestionParameter Multivalue Pin
Hakmeh Mohannad23-Feb-09 1:01
Hakmeh Mohannad23-Feb-09 1:01 
AnswerRe: Parameter Multivalue Pin
Wendelius23-Feb-09 8:50
mentorWendelius23-Feb-09 8:50 
QuestionSQL LOGIC Pin
Vimalsoft(Pty) Ltd23-Feb-09 0:28
professionalVimalsoft(Pty) Ltd23-Feb-09 0:28 
AnswerRe: SQL LOGIC Pin
Wendelius23-Feb-09 8:28
mentorWendelius23-Feb-09 8:28 
GeneralRe: SQL LOGIC Pin
Vimalsoft(Pty) Ltd23-Feb-09 19:28
professionalVimalsoft(Pty) Ltd23-Feb-09 19:28 
GeneralRe: SQL LOGIC Pin
Wendelius23-Feb-09 20:17
mentorWendelius23-Feb-09 20:17 
GeneralRe: SQL LOGIC Pin
Vimalsoft(Pty) Ltd23-Feb-09 20:35
professionalVimalsoft(Pty) Ltd23-Feb-09 20:35 
GeneralRe: SQL LOGIC Pin
Wendelius23-Feb-09 22:49
mentorWendelius23-Feb-09 22:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.