Showing posts with label clause. Show all posts
Showing posts with label clause. Show all posts

Friday, February 24, 2012

into clause

hi, how to define the temp table to local, only the current use can see it:
select * from into temp?A single # implies local temp table for the current connection/context. No
other user (on another connection) can access this #temp.
e.g.
select *
into #temp
from tb
-oj
"js" <js@.someone@.hotmail.com> wrote in message
news:OUFrxpBTFHA.1384@.TK2MSFTNGP09.phx.gbl...
> hi, how to define the temp table to local, only the current use can see
> it:
> select * from into temp?
>|||Do:
SELECT * INTO #temp FROM tbl ;
Anith|||select c1, ..., cn
into #local_temp_table
from t1
If you use one # then it is local. Use ## for global temporary.
AMB
"js" wrote:

> hi, how to define the temp table to local, only the current use can see it
:
> select * from into temp?
>
>|||how about if I don't use, global? Thks.
"Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in message
news:EC46D1A7-AF6B-4A95-ADA4-D58372CEF649@.microsoft.com...
> select c1, ..., cn
> into #local_temp_table
> from t1
> If you use one # then it is local. Use ## for global temporary.
>
> AMB
> "js" wrote:
>|||> how about if I don't use, global? Thks.
Can you re-phrase that question?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"js" <js@.someone@.hotmail.com> wrote in message news:urny42BTFHA.2128@.TK2MSFTNGP14.phx.gbl..
.
> how about if I don't use, global? Thks.
> "Alejandro Mesa" <AlejandroMesa@.discussions.microsoft.com> wrote in messag
e
> news:EC46D1A7-AF6B-4A95-ADA4-D58372CEF649@.microsoft.com...
>|||Sorry,
If you use one # then it is local. Use ## for global temporary. how about if
I don't use # or ##(select * into temp from tb1), is it global?
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23HSKB8BTFHA.3040@.TK2MSFTNGP10.phx.gbl...
> Can you re-phrase that question?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "js" <js@.someone@.hotmail.com> wrote in message
> news:urny42BTFHA.2128@.TK2MSFTNGP14.phx.gbl...
>|||Then it is a permanent table (normal one).
AMB
"js" wrote:

> Sorry,
> If you use one # then it is local. Use ## for global temporary. how about
if
> I don't use # or ##(select * into temp from tb1), is it global?
>
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote i
n
> message news:%23HSKB8BTFHA.3040@.TK2MSFTNGP10.phx.gbl...
>
>|||In SQL Query Analyzer, if i open a new query window, is it a new
connection/context?
"oj" <nospam_ojngo@.home.com> wrote in message
news:eVQ58sBTFHA.3140@.TK2MSFTNGP14.phx.gbl...
>A single # implies local temp table for the current connection/context. No
>other user (on another connection) can access this #temp.
> e.g.
> select *
> into #temp
> from tb
>
> --
> -oj
>
> "js" <js@.someone@.hotmail.com> wrote in message
> news:OUFrxpBTFHA.1384@.TK2MSFTNGP09.phx.gbl...
>|||Thanks for the help...
how to check is #temp is already in database?
"oj" <nospam_ojngo@.home.com> wrote in message
news:eVQ58sBTFHA.3140@.TK2MSFTNGP14.phx.gbl...
>A single # implies local temp table for the current connection/context. No
>other user (on another connection) can access this #temp.
> e.g.
> select *
> into #temp
> from tb
>
> --
> -oj
>
> "js" <js@.someone@.hotmail.com> wrote in message
> news:OUFrxpBTFHA.1384@.TK2MSFTNGP09.phx.gbl...
>