dbTalk Databases Forums  

Select Into -Issue , Please help

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss Select Into -Issue , Please help in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Raghu Raman
 
Posts: n/a

Default Select Into -Issue , Please help - 09-25-2008 , 12:00 PM






Hi

This is my sql query .

Select * into tmp_table1 from table1 .


If i the above query more than once in the sqlserver 2000 DB , it shows
the error 'There is already an object named 't1' in the database.'

But if i use the same from the VB6 GUI , i dont get any error .

In this case , shall i assume that eventhough more than one users try to
execute same 'select into' query from VB GUI , they all get the correct
result .Would't they get any errors ?

Please advice.

Thanks
Devasena

Six faces rule the world



*** Sent via Developersdex http://www.developersdex.com ***

Reply With Quote
  #2  
Old   
Russell Fields
 
Posts: n/a

Default Re: Select Into -Issue , Please help - 09-25-2008 , 12:52 PM






Devasena,

I suspect that you code actually looks like this, with a # before the rest
of the name.
Select * into #tmp_table1 from table1

It is a matter of the scope (the lifetime) of the temporary table. From the
BOL:
http://msdn.microsoft.com/en-us/library/ms345368.aspx

"User objects are explicitly created by the user. These objects may be in
the scope of a user session or in the scope of the routine in which the
object is created."

In the query window, once you have created #tmp_table1 in that window, it
will exist until you get rid of it. However, if you open another query
window you will be able to create #tmp_table1 there, but only one time. As
you close windows, or delete #tmp_table1 it will disappear.

If a stored procedure created #tmp_table1 internally, it would be deleted
when the the stored procedure returned.

Therefore, since your VB code is probably opening and closing connections
the temporary tables are dropped each time the connection drops.

RLF


"Raghu Raman" <raghuraman_ace (AT) rediffmail (DOT) com> wrote

Quote:
Hi

This is my sql query .

Select * into tmp_table1 from table1 .


If i the above query more than once in the sqlserver 2000 DB , it shows
the error 'There is already an object named 't1' in the database.'

But if i use the same from the VB6 GUI , i dont get any error .

In this case , shall i assume that eventhough more than one users try to
execute same 'select into' query from VB GUI , they all get the correct
result .Would't they get any errors ?

Please advice.

Thanks
Devasena

Six faces rule the world



*** Sent via Developersdex http://www.developersdex.com ***



Reply With Quote
  #3  
Old   
Russell Fields
 
Posts: n/a

Default Re: Select Into -Issue , Please help - 09-25-2008 , 12:52 PM



Devasena,

I suspect that you code actually looks like this, with a # before the rest
of the name.
Select * into #tmp_table1 from table1

It is a matter of the scope (the lifetime) of the temporary table. From the
BOL:
http://msdn.microsoft.com/en-us/library/ms345368.aspx

"User objects are explicitly created by the user. These objects may be in
the scope of a user session or in the scope of the routine in which the
object is created."

In the query window, once you have created #tmp_table1 in that window, it
will exist until you get rid of it. However, if you open another query
window you will be able to create #tmp_table1 there, but only one time. As
you close windows, or delete #tmp_table1 it will disappear.

If a stored procedure created #tmp_table1 internally, it would be deleted
when the the stored procedure returned.

Therefore, since your VB code is probably opening and closing connections
the temporary tables are dropped each time the connection drops.

RLF


"Raghu Raman" <raghuraman_ace (AT) rediffmail (DOT) com> wrote

Quote:
Hi

This is my sql query .

Select * into tmp_table1 from table1 .


If i the above query more than once in the sqlserver 2000 DB , it shows
the error 'There is already an object named 't1' in the database.'

But if i use the same from the VB6 GUI , i dont get any error .

In this case , shall i assume that eventhough more than one users try to
execute same 'select into' query from VB GUI , they all get the correct
result .Would't they get any errors ?

Please advice.

Thanks
Devasena

Six faces rule the world



*** Sent via Developersdex http://www.developersdex.com ***



Reply With Quote
  #4  
Old   
Russell Fields
 
Posts: n/a

Default Re: Select Into -Issue , Please help - 09-25-2008 , 12:52 PM



Devasena,

I suspect that you code actually looks like this, with a # before the rest
of the name.
Select * into #tmp_table1 from table1

It is a matter of the scope (the lifetime) of the temporary table. From the
BOL:
http://msdn.microsoft.com/en-us/library/ms345368.aspx

"User objects are explicitly created by the user. These objects may be in
the scope of a user session or in the scope of the routine in which the
object is created."

In the query window, once you have created #tmp_table1 in that window, it
will exist until you get rid of it. However, if you open another query
window you will be able to create #tmp_table1 there, but only one time. As
you close windows, or delete #tmp_table1 it will disappear.

If a stored procedure created #tmp_table1 internally, it would be deleted
when the the stored procedure returned.

Therefore, since your VB code is probably opening and closing connections
the temporary tables are dropped each time the connection drops.

RLF


"Raghu Raman" <raghuraman_ace (AT) rediffmail (DOT) com> wrote

Quote:
Hi

This is my sql query .

Select * into tmp_table1 from table1 .


If i the above query more than once in the sqlserver 2000 DB , it shows
the error 'There is already an object named 't1' in the database.'

But if i use the same from the VB6 GUI , i dont get any error .

In this case , shall i assume that eventhough more than one users try to
execute same 'select into' query from VB GUI , they all get the correct
result .Would't they get any errors ?

Please advice.

Thanks
Devasena

Six faces rule the world



*** Sent via Developersdex http://www.developersdex.com ***



Reply With Quote
  #5  
Old   
Russell Fields
 
Posts: n/a

Default Re: Select Into -Issue , Please help - 09-25-2008 , 12:52 PM



Devasena,

I suspect that you code actually looks like this, with a # before the rest
of the name.
Select * into #tmp_table1 from table1

It is a matter of the scope (the lifetime) of the temporary table. From the
BOL:
http://msdn.microsoft.com/en-us/library/ms345368.aspx

"User objects are explicitly created by the user. These objects may be in
the scope of a user session or in the scope of the routine in which the
object is created."

In the query window, once you have created #tmp_table1 in that window, it
will exist until you get rid of it. However, if you open another query
window you will be able to create #tmp_table1 there, but only one time. As
you close windows, or delete #tmp_table1 it will disappear.

If a stored procedure created #tmp_table1 internally, it would be deleted
when the the stored procedure returned.

Therefore, since your VB code is probably opening and closing connections
the temporary tables are dropped each time the connection drops.

RLF


"Raghu Raman" <raghuraman_ace (AT) rediffmail (DOT) com> wrote

Quote:
Hi

This is my sql query .

Select * into tmp_table1 from table1 .


If i the above query more than once in the sqlserver 2000 DB , it shows
the error 'There is already an object named 't1' in the database.'

But if i use the same from the VB6 GUI , i dont get any error .

In this case , shall i assume that eventhough more than one users try to
execute same 'select into' query from VB GUI , they all get the correct
result .Would't they get any errors ?

Please advice.

Thanks
Devasena

Six faces rule the world



*** Sent via Developersdex http://www.developersdex.com ***



Reply With Quote
  #6  
Old   
Russell Fields
 
Posts: n/a

Default Re: Select Into -Issue , Please help - 09-25-2008 , 12:52 PM



Devasena,

I suspect that you code actually looks like this, with a # before the rest
of the name.
Select * into #tmp_table1 from table1

It is a matter of the scope (the lifetime) of the temporary table. From the
BOL:
http://msdn.microsoft.com/en-us/library/ms345368.aspx

"User objects are explicitly created by the user. These objects may be in
the scope of a user session or in the scope of the routine in which the
object is created."

In the query window, once you have created #tmp_table1 in that window, it
will exist until you get rid of it. However, if you open another query
window you will be able to create #tmp_table1 there, but only one time. As
you close windows, or delete #tmp_table1 it will disappear.

If a stored procedure created #tmp_table1 internally, it would be deleted
when the the stored procedure returned.

Therefore, since your VB code is probably opening and closing connections
the temporary tables are dropped each time the connection drops.

RLF


"Raghu Raman" <raghuraman_ace (AT) rediffmail (DOT) com> wrote

Quote:
Hi

This is my sql query .

Select * into tmp_table1 from table1 .


If i the above query more than once in the sqlserver 2000 DB , it shows
the error 'There is already an object named 't1' in the database.'

But if i use the same from the VB6 GUI , i dont get any error .

In this case , shall i assume that eventhough more than one users try to
execute same 'select into' query from VB GUI , they all get the correct
result .Would't they get any errors ?

Please advice.

Thanks
Devasena

Six faces rule the world



*** Sent via Developersdex http://www.developersdex.com ***



Reply With Quote
  #7  
Old   
Russell Fields
 
Posts: n/a

Default Re: Select Into -Issue , Please help - 09-25-2008 , 12:52 PM



Devasena,

I suspect that you code actually looks like this, with a # before the rest
of the name.
Select * into #tmp_table1 from table1

It is a matter of the scope (the lifetime) of the temporary table. From the
BOL:
http://msdn.microsoft.com/en-us/library/ms345368.aspx

"User objects are explicitly created by the user. These objects may be in
the scope of a user session or in the scope of the routine in which the
object is created."

In the query window, once you have created #tmp_table1 in that window, it
will exist until you get rid of it. However, if you open another query
window you will be able to create #tmp_table1 there, but only one time. As
you close windows, or delete #tmp_table1 it will disappear.

If a stored procedure created #tmp_table1 internally, it would be deleted
when the the stored procedure returned.

Therefore, since your VB code is probably opening and closing connections
the temporary tables are dropped each time the connection drops.

RLF


"Raghu Raman" <raghuraman_ace (AT) rediffmail (DOT) com> wrote

Quote:
Hi

This is my sql query .

Select * into tmp_table1 from table1 .


If i the above query more than once in the sqlserver 2000 DB , it shows
the error 'There is already an object named 't1' in the database.'

But if i use the same from the VB6 GUI , i dont get any error .

In this case , shall i assume that eventhough more than one users try to
execute same 'select into' query from VB GUI , they all get the correct
result .Would't they get any errors ?

Please advice.

Thanks
Devasena

Six faces rule the world



*** Sent via Developersdex http://www.developersdex.com ***



Reply With Quote
  #8  
Old   
Russell Fields
 
Posts: n/a

Default Re: Select Into -Issue , Please help - 09-25-2008 , 12:52 PM



Devasena,

I suspect that you code actually looks like this, with a # before the rest
of the name.
Select * into #tmp_table1 from table1

It is a matter of the scope (the lifetime) of the temporary table. From the
BOL:
http://msdn.microsoft.com/en-us/library/ms345368.aspx

"User objects are explicitly created by the user. These objects may be in
the scope of a user session or in the scope of the routine in which the
object is created."

In the query window, once you have created #tmp_table1 in that window, it
will exist until you get rid of it. However, if you open another query
window you will be able to create #tmp_table1 there, but only one time. As
you close windows, or delete #tmp_table1 it will disappear.

If a stored procedure created #tmp_table1 internally, it would be deleted
when the the stored procedure returned.

Therefore, since your VB code is probably opening and closing connections
the temporary tables are dropped each time the connection drops.

RLF


"Raghu Raman" <raghuraman_ace (AT) rediffmail (DOT) com> wrote

Quote:
Hi

This is my sql query .

Select * into tmp_table1 from table1 .


If i the above query more than once in the sqlserver 2000 DB , it shows
the error 'There is already an object named 't1' in the database.'

But if i use the same from the VB6 GUI , i dont get any error .

In this case , shall i assume that eventhough more than one users try to
execute same 'select into' query from VB GUI , they all get the correct
result .Would't they get any errors ?

Please advice.

Thanks
Devasena

Six faces rule the world



*** Sent via Developersdex http://www.developersdex.com ***



Reply With Quote
  #9  
Old   
Russell Fields
 
Posts: n/a

Default Re: Select Into -Issue , Please help - 09-25-2008 , 12:52 PM



Devasena,

I suspect that you code actually looks like this, with a # before the rest
of the name.
Select * into #tmp_table1 from table1

It is a matter of the scope (the lifetime) of the temporary table. From the
BOL:
http://msdn.microsoft.com/en-us/library/ms345368.aspx

"User objects are explicitly created by the user. These objects may be in
the scope of a user session or in the scope of the routine in which the
object is created."

In the query window, once you have created #tmp_table1 in that window, it
will exist until you get rid of it. However, if you open another query
window you will be able to create #tmp_table1 there, but only one time. As
you close windows, or delete #tmp_table1 it will disappear.

If a stored procedure created #tmp_table1 internally, it would be deleted
when the the stored procedure returned.

Therefore, since your VB code is probably opening and closing connections
the temporary tables are dropped each time the connection drops.

RLF


"Raghu Raman" <raghuraman_ace (AT) rediffmail (DOT) com> wrote

Quote:
Hi

This is my sql query .

Select * into tmp_table1 from table1 .


If i the above query more than once in the sqlserver 2000 DB , it shows
the error 'There is already an object named 't1' in the database.'

But if i use the same from the VB6 GUI , i dont get any error .

In this case , shall i assume that eventhough more than one users try to
execute same 'select into' query from VB GUI , they all get the correct
result .Would't they get any errors ?

Please advice.

Thanks
Devasena

Six faces rule the world



*** Sent via Developersdex http://www.developersdex.com ***



Reply With Quote
  #10  
Old   
Russell Fields
 
Posts: n/a

Default Re: Select Into -Issue , Please help - 09-25-2008 , 12:52 PM



Devasena,

I suspect that you code actually looks like this, with a # before the rest
of the name.
Select * into #tmp_table1 from table1

It is a matter of the scope (the lifetime) of the temporary table. From the
BOL:
http://msdn.microsoft.com/en-us/library/ms345368.aspx

"User objects are explicitly created by the user. These objects may be in
the scope of a user session or in the scope of the routine in which the
object is created."

In the query window, once you have created #tmp_table1 in that window, it
will exist until you get rid of it. However, if you open another query
window you will be able to create #tmp_table1 there, but only one time. As
you close windows, or delete #tmp_table1 it will disappear.

If a stored procedure created #tmp_table1 internally, it would be deleted
when the the stored procedure returned.

Therefore, since your VB code is probably opening and closing connections
the temporary tables are dropped each time the connection drops.

RLF


"Raghu Raman" <raghuraman_ace (AT) rediffmail (DOT) com> wrote

Quote:
Hi

This is my sql query .

Select * into tmp_table1 from table1 .


If i the above query more than once in the sqlserver 2000 DB , it shows
the error 'There is already an object named 't1' in the database.'

But if i use the same from the VB6 GUI , i dont get any error .

In this case , shall i assume that eventhough more than one users try to
execute same 'select into' query from VB GUI , they all get the correct
result .Would't they get any errors ?

Please advice.

Thanks
Devasena

Six faces rule the world



*** Sent via Developersdex http://www.developersdex.com ***



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.