I am using table variables instead of creating a temp table because it seems to be faster
But now I need qualify the table variable so I can join it with another table having a field with same name of a field from the table variable. U know if I can do that?
ex: with temp table
create table #tmp... (F1...)
#tmp.f1
with table variable
declare @.temp table(...
@.table.f1 - can´t do it
the first question is if I can join the table variable with another table and how to do that qualifying the variable table, that is, putting the name of the var temp with the field, because the other table has a field with same name
thank to all and happiness for all 2004Hi all
I think I found the solution
It is not possible to qualify the talble variable because it is not part of a persistent table, so I cant assing table variables,
I saw it in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tsqlref/ts_de-dz_66w5.asp
it is the same as in sql 2000 BOL
thanks. so I have to use a temp table to qualify it if I want to join the table. My thinking is that I can join table variables
hope it is useful to u|||Hi all!
Thanks for having the time to read it
I was wrong and found the solution.
I can join and qualify a table var, only aliasing the table as in
insert into @.table... join temp.field...
from @.vartemp temp
--
here temp is the alias of @.vartemp, so I can use this alias instead of @.vartemp when, for example, there are two fields with same name in two tables, and one is @.vartemp
Now, once solved it, my problem is with UPDATETEXT. I am updating a text field and need to qualify the @.vartable in order to update it using a pointer to the text field. Since there are not any FROM clause as above, I dont know where to qualify the @.vartable (tried qualifying in DECLARE, but cant do it there)
UPDATETEXT @.vartemp.pointer - cant use @.vartemp, need an alias, but where to give the alias?
Thanks all!
No comments:
Post a Comment