-
drop or delete temp table problem
Hi all,
I deal with a download functions. and store the user checked index into temp table. and allow user download the infomation by the index they store, I call a few store procedure online, Now I need to drop or delete temp table every time I call this stroe procedure
Code:
drop proc checked
go
create proc checked
AS
begin
begin transaction
select * FROM temp
if @@error <>0 or @@rowcount !=1
begin
rollback
return
end
commit transaction
end
GO
I try drop table and recreat it in the procedure , it seems not work?
how to deal with it??
________
Maine marijuana dispensaries
Last edited by sql; 03-06-2011 at 01:58 AM.
-
Why don't you use real temporary table with #temp (# makes it temporary). From your code you have created a regular table for temporary use.
-
hi yes, but #temp is not allow me to inser from web
Code:
stmt.executeUpdate("insert into #temp ("
+ "NewNum)"
+ "VALUES('"
+ select + "'"
+ ")");
and I nee dto use this data when I call it procedure checked
Thank you
________
C170 Platform
Last edited by sql; 03-06-2011 at 01:58 AM.
-
then use static table. You can get unique session id using GUID to keep track of every user in the same table and you could do the cleanup of this table every night based on the inactive sessions.
-
Hi Mark,
Thank you for your reply, May I know what session Id you mention in here? http session ID or database session Id, I have some experience in http session ID, but not Ms database session ID, is MS sql also have session ID??
actually, I have some Ideal to handle my problem on if the new search is found delete or recode in temp, if log out action is found , delete or reode in temp, not ideal, if the users don't log out, of course , after web server session time out , it will direct the user to the login page, but how to clean their recode which is store in datbase. is database itself have session too???
________
HOMEMADE VAPORIZER
Last edited by sql; 03-06-2011 at 01:58 AM.
-
Hi all,
I got it, maybe is too complicate, but I handle the requiremebt
the logic in here is
if found new search
delete all recode in temp
if logoff found
delete all recode in temp
if search userid = userId and sessionid<>sessionid
delete all recode
in here ssssionid is the catch the http sessionid, I am sure the sessionId is different
so if the same user login to the set and have some download, and did not login off just close the page, and next time it try to use the download function again , willl not download enerything they select it before.
is that ideal may seens??
by the way can anyone tell me, session on Ms DB??
Thank you
________
ASCOT
Last edited by sql; 03-06-2011 at 01:58 AM.
-
hi,
in MS sql is there a way to delete the insert data, which is old then one day.
________
Herbal vaporizers
Last edited by sql; 03-06-2011 at 01:59 AM.
-
Yes if the table has timestamp kind of column.
-
not easy to understand the timestampe, and not ideal how to handle, is there timestamp have any relation with full text search??
Thank you
________
Vapir One Vaporizer
Last edited by sql; 03-06-2011 at 01:59 AM.
-
Datetime column is timestamp kind of column too, timestamp has nothing to do with full text search.
-
could you just give mw a example to handle it
thank you
________
Starcraft 2 Replays
Last edited by sql; 03-06-2011 at 01:59 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|