Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > temp table problem?

Reply
Thread Tools

temp table problem?

 
 
Savas Ates
Guest
Posts: n/a
 
      10-12-2004
i have a stored below

it uses create temp table and drop temp table... when more than one user
request the same page it probably returns error.. how can i solve this
problem

************************************************** **************************
*****************************************
CREATE PROCEDURE st_seconddegree
@fromwhom numeric(1, @towhom numeric(1 AS


SET NOCOUNT ON
if not exists (select 1 from crosstable where (fromwhom=@fromwhom and
towhom=@towhom ) or (fromwhom=@towhom and towhom=@fromwhom))
Begin
create table #pele1
(xuserid numeric(1,xarkid numeric (1
)
insert into #pele1 SELECT
xuserid = CASE WHEN fromwhom <> @fromwhom then @fromwhom ELSE fromwhom
END,
xarkid = CASE WHEN fromwhom = @fromwhom then towhom ELSE fromwhom END


FROM crosstable
where fromwhom=@fromwhom or towhom=@fromwhom

create table #pele2
(xuserid numeric(1,xarkid numeric (1
)
insert into #pele2
SELECT
xuserid = CASE WHEN fromwhom <> @towhom then @towhom ELSE fromwhom END,
xarkid = CASE WHEN fromwhom = @towhom then towhom ELSE fromwhom END

FROM crosstable
where fromwhom=@towhom or towhom=@towhom

select #pele1.xarkid as xarkid from #pele1 INNER JOIN #pele2 ON
#pele1.xarkid=#pele2.xarkid;
drop table #pele1
drop table #pele2
End
GO
************************************************** **************************
**********************************************


 
Reply With Quote
 
 
 
 
Keith Kratochvil
Guest
Posts: n/a
 
      10-12-2004
"when more than one user request the same page it probably returns error"

Are you guessing that the stored procedure will error when multiple people
(connections/users) call it at the same time? Temp tables are only visible
to the connection that created them, therefore there will not be a problem
with multiple users calling this stored procedure at the same time.

--
Keith


"Savas Ates" <(E-Mail Removed)> wrote in message
news:OfV4Q$(E-Mail Removed)...
> i have a stored below
>
> it uses create temp table and drop temp table... when more than one user
> request the same page it probably returns error.. how can i solve this
> problem
>
>

************************************************** **************************
> *****************************************
> CREATE PROCEDURE st_seconddegree
> @fromwhom numeric(1, @towhom numeric(1 AS
>
>
> SET NOCOUNT ON
> if not exists (select 1 from crosstable where (fromwhom=@fromwhom and
> towhom=@towhom ) or (fromwhom=@towhom and towhom=@fromwhom))
> Begin
> create table #pele1
> (xuserid numeric(1,xarkid numeric (1
> )
> insert into #pele1 SELECT
> xuserid = CASE WHEN fromwhom <> @fromwhom then @fromwhom ELSE fromwhom
> END,
> xarkid = CASE WHEN fromwhom = @fromwhom then towhom ELSE fromwhom END
>
>
> FROM crosstable
> where fromwhom=@fromwhom or towhom=@fromwhom
>
> create table #pele2
> (xuserid numeric(1,xarkid numeric (1
> )
> insert into #pele2
> SELECT
> xuserid = CASE WHEN fromwhom <> @towhom then @towhom ELSE fromwhom

END,
> xarkid = CASE WHEN fromwhom = @towhom then towhom ELSE fromwhom END
>
> FROM crosstable
> where fromwhom=@towhom or towhom=@towhom
>
> select #pele1.xarkid as xarkid from #pele1 INNER JOIN #pele2 ON
> #pele1.xarkid=#pele2.xarkid;
> drop table #pele1
> drop table #pele2
> End
> GO
>

************************************************** **************************
> **********************************************
>
>


 
Reply With Quote
 
 
 
 
Aaron [SQL Server MVP]
Guest
Posts: n/a
 
      10-12-2004
> it uses create temp table and drop temp table... when more than one user
> request the same page it probably returns error.. how can i solve this
> problem


This isn't a problem. Have you actually observed errors? Have you tried
producing an error? Perhaps you should read up on temp tables...

--
http://www.aspfaq.com/
(Reverse address to reply.)


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FAQ 5.36 Why can't I use "C:\temp\foo" in DOS paths? Why doesn't `C:\temp\foo.exe` work? PerlFAQ Server Perl Misc 0 04-26-2011 10:00 AM
How to initialize member reference with temp object and delete the temp object when the destructor is called? PengYu.UT@gmail.com C++ 2 05-09-2005 05:48 PM
Temp Table not found or Doesn't exists !!!! Ahmed Jewahar ASP .Net 2 04-05-2004 03:04 PM
File::Temp: opening the temp. file in "r+" mode? Also "man in the middle" A. Farber Perl Misc 3 03-03-2004 12:42 PM
Temp Internet and temp files now in winnt directory w2k pro Bibble Bobble Computer Support 1 11-27-2003 06:14 PM



Advertisments