Hello,
I am using SQL 2000 to test the query.
I have a Temporary Table: #Temp_Word_List
And a second table: #t
I am dynamically executing a select query on #Temp_Word_list
The select query is implemented as an Insert into a Temporary Table #t and then I try to read the temporary table #t.
The query is failing to retrieve the result from #Temp_Word_list into #t and always returns 0
I checked the #Temp_word_List in the query analyzer output and it has the right values but the output of #t always shows 0
Code Snippet as follows:
set @curr_char = UPPER(substring(@unique_word_string , @Len+1, 1))
delete from #t
set @temp_query_string_part_1 = ' from #Temp_word_list where KeywordID = '
set @temp_query_string_part_2 = @curr_KeywordID
set @temp_query_string_part_1 = @temp_query_string_part_1 + @temp_query_string_part_2
set @temp_query_string = 'Insert into #t Select ' + @curr_char + @temp_query_string_part_1
Print ' String is ' + @temp_query_string
Exec ( @temp_query_string )
Select @curr_char_rank = IsNull(num_sample,0) from #t
Select * from #t
*****************************************
OUTPUT QUERY As Showing in Print output:
*****************************************
Insert into #t Select T from #Temp_word_list where KeywordID = 2
******************************************
#Temp_word_list
******************************************
Column Name ----------- Column Type
--------------------------
KeywordID ---------- int
T ----------------- float
--------------------------
1 Record: KeywordID = 2 T = 0.5
******************************************
# t
******************************************
1 Column and 1 Row = num_sample
Type = float
Value = 0
Value should be 0.5
******************************************
I am using SQL 2000 to test the query.
I have a Temporary Table: #Temp_Word_List
And a second table: #t
I am dynamically executing a select query on #Temp_Word_list
The select query is implemented as an Insert into a Temporary Table #t and then I try to read the temporary table #t.
The query is failing to retrieve the result from #Temp_Word_list into #t and always returns 0
I checked the #Temp_word_List in the query analyzer output and it has the right values but the output of #t always shows 0
Code Snippet as follows:
set @curr_char = UPPER(substring(@unique_word_string , @Len+1, 1))
delete from #t
set @temp_query_string_part_1 = ' from #Temp_word_list where KeywordID = '
set @temp_query_string_part_2 = @curr_KeywordID
set @temp_query_string_part_1 = @temp_query_string_part_1 + @temp_query_string_part_2
set @temp_query_string = 'Insert into #t Select ' + @curr_char + @temp_query_string_part_1
Print ' String is ' + @temp_query_string
Exec ( @temp_query_string )
Select @curr_char_rank = IsNull(num_sample,0) from #t
Select * from #t
*****************************************
OUTPUT QUERY As Showing in Print output:
*****************************************
Insert into #t Select T from #Temp_word_list where KeywordID = 2
******************************************
#Temp_word_list
******************************************
Column Name ----------- Column Type
--------------------------
KeywordID ---------- int
T ----------------- float
--------------------------
1 Record: KeywordID = 2 T = 0.5
******************************************
# t
******************************************
1 Column and 1 Row = num_sample
Type = float
Value = 0
Value should be 0.5
******************************************