SEARCH YOUR SOLUTION HERE  

when table purge

I have set up code that whenever I user returns the site a new cookie is created(persistent) and the token
is stored in the corresponding table in the database.

Suppose that someone comes 2-3 times/day in the site,multiply that with number of registered users and
the tables gets written many times,becoming large quickly.

SO...how often should I erase table rows you think
Do you think-for example- that from the moment I create a token to the table I should delete the previous one-belonging to the same user obviously

Is there a rule of thumb in this

As a second though, maybe I just need update the token in the place of the previous one
Edited by jimfog, 10 October 2012 - 09:19 AM.

Posted On: Monday 31st of December 2012 01:55:48 AM Total Views:  1965
View Complete with Replies




Related Messages:

SQL stmt to transfer data between different table structure   (218 Views)
How to write a sql statement to transfer data between two or more different table structure My Old Table structure: Patient Name,DOB,Add1,Add2,Add3,Postcode,DateCreated My New Table structure: tbl_Patient PatientID(auto),PRN,PatientName,DOB,Add1,Add2,Postcode,DateCreated I would like to map the data like below: tbl_Patient.PatientID -> auto increment Patient.Name -> tbl_Patient.PatientName tbl_Patient.PRN-> increase as records added into table Patient.DOB -> tbl_Patient.DOB Is it possible to write a sql to do the above requirement I am thinking that stored procedure might do but i have never write a store procedure before.
Query help - Select specific rows from a table?   (219 Views)
! can anyone help me to retrive some rows from the midle of the table, if each of the column are of type varchar suppose i have a table containing 100 rows. then is there any way by which i can retrive, for example, rows 30 to 40 Thank u so much 4 ur consideration. Shoeb
Erase table   (197 Views)
all How we erase a precise table in a data base under SQL serveur2000 Thank you
Creating inter-table relationships using Primary Keys/Foreign Keys Problem   (197 Views)
again, I'm going through my tables and rewriting them so that I can create relationship-based constraints and create foreign keys among my tables. I didn't have a problem with a few of the tables but I seem to have come across a slightly confusing hiccup. Here's the query for my Classes table: Code: CREATE TABLE Classes ( class_id INT IDENTITY PRIMARY KEY NOT NULL, teacher_id INT NOT NULL, class_title VARCHAR(50) NOT NULL, class_grade SMALLINT NOT NULL DEFAULT 6, class_tardies SMALLINT NOT NULL DEFAULT 0, class_absences SMALLINT NOT NULL DEFAULT 0, CONSTRAINT Teacher_instructs_ClassFKIndex1 FOREIGN KEY (teacher_id) REFERENCES Users (user_id) ) This statement runs without problems and I Create the relationship with my Users table just fine, having renamed it to teacher_id. I have a 1:n relationship between users and tables AND an n:m relationship because a user can be a student or a teacher, the difference is one field, user_type, which denotes what type of user a person is. In any case, the relationship that's 1:n from users to classes is that of the teacher instructing the class. The problem exists when I run my query for the intermediary table between the class and the gradebook: Code: CREATE TABLE Classes_have_Grades ( class_id INT PRIMARY KEY NOT NULL, teacher_id INT NOT NULL, grade_id INT NOT NULL, CONSTRAINT Grades_for_ClassesFKIndex1 FOREIGN KEY (grade_id) REFERENCES Grades (grade_id), CONSTRAINT Classes_have_gradesFKIndex2 FOREIGN KEY (class_id, teacher_id) REFERENCES Classes (class_id, teacher_id) ) Query Analyzer spits out: Quote: Originally Posted by Query Analyzer There are no primary or candidate keys in the referenced table 'Classes' that match the referencing column list in the foreign key 'Classes_have_gradesFKIndex2'. Now, I know in SQL Server 2000 you can only have one primary key. Does that mean I can have a multi-columned Primary key (which is in fact what I would like) or does that mean that just one field can be a primary key and that a table can have only the one primary key In addition, what is a "candidate" key Will making the other fields "Candidate" keys solve my problem Thank you for your assistance.
loop though table using RowID, not cursor (was "Loop")   (185 Views)
I have a table with RowID(identity). I need to loop though the table using RowID(not using a cursor). Please help me.
Issues importing a text file (tab delimited) to a SQL table   (221 Views)
I have a text file I am trying to import to a table. This text file is in a tab delimited format. I am using DTS to import the data to a new table I made. The fields are varchar and are set to allow nulls & allow 8,000 characters per field. The error I am getting is that the data exceeds the allowed amount (or something like that) in col4. Now I have checked everything in column 4 and nothing exceeds 5,000 spaces/characters combined. I have checked the entire sheet (in excel) for that fact, and there is not one single column/row/cell that exceeds 5,000 spaces/characters combined. What the heck could be causing SQL to tell me I am trying to import too much data in one column when there is nothing that even comes close to 8,000 characters & spaces combined
Code for creating a table in SQL from external source   (211 Views)
I'm looking to create a table in SQL using data from the as/400. I need some code that extracts it from as/400 using odbc and I need it to loop and create that table every minute. The file its retrieving is a live file but not very large.. I need to basically poll the data. Does anyone have code for something like this..
add checkbox column to access table (was "SQL query help.., please, any one??")   (199 Views)
good people of this forum.. I am working on an eccess db, and using asp to update, change and so on... I want to add dynamicly a field to the db, using the ALTER TABLE command, but for some reson I can't find a way to make it work, the field type I am trying to add is boolean, and I want it to show up in the actual db as a checkbox, and not as a bit field (0/1), so I've been trying this and non of them work, and I couldn't find any sites with examples for this... any help would be very appricated..., this is what I've tryed so far and didn't work: "ALTER TABLE [Users] ADD [CHILD] boolean" "ALTER TABLE [Users] ADD [CHILD] boolean False" "ALTER TABLE [Users] ADD [CHILD] boolean(f)" "ALTER TABLE [Users] ADD [CHILD] boolean f" me out on this
table Self-joins with updates   (207 Views)
table = PEOPLE Name Money Type ----- ----- ---- Steve 400 R Steve 100 R Paul 500 R Paul 100 R Matt 500 R Matt 200 R Matt 0 T Steve 0 T Paul 0 T I'm trying to add-up all of the Money values for each Name and store them into their names, but under Type 'T'. after the update command it should look like this Name Money Type ----- ----- ---- Steve 400 R Steve 100 R Paul 500 R Paul 100 R Matt 500 R Matt 200 R Matt 700 T Steve 500 T Paul 600 T
Trying to pull data from 2 tables into a query   (190 Views)
I'm trying to create a SQL query to pull together a job info table and a customer info table in an Access DB. We can't have a unique ID on the customer that we can store in the job table because the customer info is dumped from Exchange and the ID (row number) in the cust_List table will change each time we export from Exchange. What I need to do is go through jobs, get the CO_ID, the CONTACT_LN and the CONTACT_FN and then match it against Customer_List>Account, Lastname, Firstname. Any ideas
Checking duplicate values two tables   (202 Views)
Hi , Is it possible in SQL to Restrict value in one table checking a value on anather tables. Scenerio-1. I have two table let say, Teb1 and Teb2. Teb1 has a column called- Business_type and Teb2 has a coulmn called Incorporated_date. I just need to restrict If the value of Business_type column in Teb1 is "Propritory" then Incorporated_date in Teb2 should not be blank (nulll) . Otherwise it can take null value. Scenerio -2.[/B] I have table called [B]SIC. This table has a two column called SIC1 anc SIC2 . Is it possible to restrict that clumn SIC1 and SIC2 should have same values( duplicate values cannot be entered in both columns. Please Advise. Vijay
Converting a SQL table into Text file   (218 Views)
How to convert a SQL table into Text file I have a table and I want to extract the values with the field names above to a text file. The query should also allow me to define the starting position of the fields in the text file. email: vijay.prasad@in.ibm.com
Copying data from one table to another table   (198 Views)
I need to copy data from one table into another table. The field names are NOT the same: I need to INSERT Table 1 fields: cdescurl cname cdescription cimageurl category cprice INTO Table 2: product_url name description image_url category price How do I do this Thank you in advance for any help you can give me!
copy table to different server   (212 Views)
i need a script that can copy a table from a db on one server to another for me, but i have no idea how.. help much appreciated !
aggregates from two unrelated tables   (225 Views)
Hi I have similar problem and i explained in detail here http://www.balainfo.com/forums/viewtopic.phpt=39 Pls help me to fix this sql Regds Bala
Combining info from two tables?   (240 Views)
, I'm having some problems trying to access two tables in a SQL database at the same time and making some results out of them. Let me explain further: the first table has some information in that I'm going to be doing a select query on and reading out, but one of the columns in this table is a set of codes, the second table contains the codes in one column and their meanings in the other. So I want to bring back the information from the first table and then select the information for the codes shown from the second table and print their meanings alongside the information from the first table. Could anyone help me out in figuring out how my SQL in the ASP page for this would be written Sorry if this is a little confusing but im having a hard time visualising how to do this.
Help with MS SQL Server - updating data from 2 tables   (213 Views)
Hi all, Please forgive me, but I'm new to MS SQL Server and I have few questions. First of all I'd like to know if there is a way to update one table with the data from another. Let's say I have 2 tables. TableA table contains the voucher numbers; TableB table contains the image numbers. Is there a way to merge Voucher numbers from TableA table to Image numbers in TableB table if we assume that there is a primary key Voucher Number in both tables If yes- what would be the query structure for that Please forgive me if you think that this question is silly, I have to say I'm not just new to SQL I'm VERY new to it Thank you in advance.
problem w/ linked table permissions   (222 Views)
This question involves SQL server as well as Access, so I hope that someone can follow. I'm trying to give someone read and write access to a table in SQL server through a linked table scenario in Access. I set up a new user account with datareader and datawriter permissions and made sure it went into the particular table as well. I also re-created the DSN on the user's local machine using this new login information. However, each time you open up the table after logging in using this info and try to edit a field, it gives a "Write Conflict" error and gives three choices: Save Changes, Copy to Clipboard, Drop Changes and of course, Save Changes is disabled. We also tried logging in using the db admin account and it won't work. Anyone have similar experiences with this If so, is there a work-around so that you can edit data through Access
two select statements on one table   (225 Views)
Im trying to perform the following two select statements on the one table. I have been trying innerjoins etc but keep getting errors. The basis of what im trying to do is this. SELECT column1 FROM table1 WHERE column2 = (select column2 from table1 where column3 = 14) Any ideas greatly appreciated.
Open table in Query Analyzer   (208 Views)
In query Analyzer you can right click on a table and select open. When you do it opens the table as if you were in Enterprise Manager(you can edit the data). Does anyone know the syntax of how to write that in a query so you do not have to right click and select open
How to attch files   (169 Views)
Hi Guys, I want to attach a file as attachment, how can i do that in this forum I couldnt find any button or icon to do that
Migrate Sybase DB to MS SQL... datetime problem.   (223 Views)
I have a Sybase server with my source data. I have a MS SQL 2000 server for my destination. Trying to migrate all the data from the Sybase instance over to the SQL instance... not really all the data, just the tables that have a rowcount above '0'. I don't care about PK/FK relationships, constraints, triggers or stored procs. I came up with the following script, using the linked server features of SQL2000. Code: declare tablecursor scroll cursor for select name from openquery(LINKEDSERV, 'select name from sysobjects where type= ''U'' and uid = 1 order by name') open tablecursor declare @tablename varchar(50) declare @sql nvarchar(800) fetch first from tablecursor into @tablename while @@fetch_status = 0 begin set @sql = N' IF (select * from openquery(LINKEDSERV, ''select count(*) from ' + @tablename + ''')) > 0 BEGIN select * into TargetDB.dbo.' + @tablename + N' from openquery(LINKEDSERV, ''select * from ' + @tablename + ''') END' -- select @sql exec sp_executesql @sql fetch next from tablecursor into @tablename end close tablecursor deallocate tablecursor But, about part way through I get an error. Server: Msg 8114, Level 16, State 10, Line 3 Error converting data type DBTYPE_DBDATE to datetime. Seems that implicit conversion is not working for the Sybase datetime datatype and the SQL2000 datetime datatype. I don't want to write an import for each table... I have about 100 total tables to target. Any ideas Can DTS help in this case, even though this source server is not an MS server I want the whole database, and I don't want to write a construct for each table.
Installing Developers Edition   (225 Views)
I want to install MS SQL server to my machine but first I would like some advise of you pro's who have done it already. The following is my setup. 1.- My development machine WindowsXP Pro 1Gig ram and 250gigs HD Loaded with my dev.Software from Dreamweaver, graphic apps and so on. 2.- The machine I want to install on is a WindowsXP Pro sp2 with 1 Gig Ram and plenty of HD space. and runing Apache and PHP and MySQL 3.- Win Server 2003 Sp2, 1GIG of ram where I test my ASP websites. The last time attempted install MS SQL something went totally wrong and corrupted my machine somehow and I had to re-install everything I had. So, this time I want some advice: Do I have to have IIS on the same machine as MS SQL or can I have IIS on one, let say my 3rd machine and install SQL on my second machine Any ideas please let me know
Can't get this query right.   (218 Views)
Have a table full of organizations and I want to select those with a unique name. But I also need any ID as well. But that seems to conflict with Group By. It doesn't matter which id. orgName, id
String function query   (211 Views)
i have a table of following structure Names Raj Kumar Pradeep Kumar Syam Sundhra Javagal Srinath Pandit Ravishankar I need a query with output as follows Names RK PK SS JS PR
Installing Microsoft SQL Server 2000 on Windows XP Professional.   (196 Views)
hi, I'm trying to install Microsoft SQL Server 2000 Standard Edition on a Windows XP Professional. During Installation, I received this message as shown below: "Microsoft SQL Server 2000 Standard Edition server Component is not supported on this operating system. Only client components will be available for installation." What should I do Is it a must to install the SQL 2000 server on Windows 2000 server Please help and
Getting error to Connect MS-SQL2005 from remote desktop(using public IP address) connection to DotNet windows application   (220 Views)
I have a dot net windows application which can be download from the website. I want to use the database for the application by using public IP address. I am not able to connect SQL server 2005 from remote connection it is giving me the error, SQL server does not allow remote connection. I changed my server remote connection configuration to Local and remote connection using both TCP/IP and named pipes but still i am getting the error. please help me
Dead-Man switch for stored procedure   (209 Views)
I probably should know the answer to this, but it is eluding me. I have a stored procedure called Morning_Refresh something like this: CREATE PROCEDURE Morning_Refresh AS -- create snapshot DELETE FROM Static1; INSERT INTO Static1 Select * From Table1; -- updates in system UPDATE TABLE2 SET X = (Select Y FROM Table1); UPDATE TABLE3 SET X = 'C' WHERE ID NOT IN (SELECT ID FROM TABLE1); And so forth. Now, all is well, there is a real chance that that Table1 that I am updating everything with could be bad. I want to add some sort of sanity check to the procedure, so that if Table1 does not meet certain requirement, NOTHING gets changed. For now, the check will simply be that there in fact are records in Table1. How can I modify the stored procedure so that it will do nothing if there are no records in Table1
SQL SP Validation   (196 Views)
I have project where I am building an ASP.NET Internal Website that will run Updates, Selects, and Inserts on a SQL Server 2005 Database. There will be a series of forms that will call stored procedures rather than have embedded SQL. I would like to design the SP in such a way that I can do validation like, if the record already exists, do not INSERT and return an error code to the web page. I would also like to have a main Validation SP that all other SPs will call if a particular error occurs. For example, if a record already exists, it will return an error code of 1. OR ... it will call another SP and send that error code of 1 as a variable which will then display a standard message. Any ideas regarding this and the design of that SP. How would I send the message to the web app Is that a RETURN value Thank You, Marc
verifying user details   (222 Views)
New to mssql but the following code works fine in access, whereby in mssql it will return a recordset of name and password but wont verify, all I can assume is its something to do with the server settings, does anyone have any ideas
Error: Invalid object name   (279 Views)
I have this error message: Error Type: Microsoft OLE DB Provider for ODBC Drivers (0x80040E37) [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'Cajas'. /sanjose/ventas/tira.asp, line 14 The object name is: 'CAJAS' Note, the object name are Uppercase! Why show this message How I tell to SQL Server that takes the name of my tables without being case sensitive to the form like this writing Are 30 tables on my database. Many ASP programs on my project.
Stop running sql server at start up   (239 Views)
I'm attempting to fine tune my laptop to make it run quicker. It's running very slow at the moment. So many processes running using svchost.exe I'm using windows xp I have noticed sql server always running and I would assume this would consume a lot of cpu. I dont need this to run, or do I It automatically starts at start up. How do I stop this please assuming I dont need sql server running
MSDE 2000 in web base application   (181 Views)
i'm newbies in SQL database. I would like to develop a low cost offline database application using MSDE2000. The application will consist of two PC only (one as client & another as server) and is web base style (means using IE6) and coded with javascript + XHTML. Can anyone tell me how to do that
Windows 2008 SQL Server   (193 Views)
My website is hosted with Webhost4life.Org (Recommend), I'd like to know how to transfer SQL 2005 to SQL 2008
Getting databases available on Server   (224 Views)
I have the SERVER name as a variable and I need to get the databases list on that server into a drop down. How can it be done
SQL Query   (193 Views)
I have a column for availability in the Options table. This column contains 2 records 1st record: "Monday, Tuesday, morning" 2nd record: "Monday, evening". How do i write a query that returns" 1st record: if "avail = morning" both records: if "avail = monday" both records: if "avail = monday, morning"
hi i m having problem   (213 Views)
i m using MSDE i m trying to use session object to work with it. i dont know how to do it can someone help.....here is what i have written: ALTER PROCEDURE reportjobposted ( @emuser varchar (20) ) AS SELECT Jobs.jid, Jobs.joposted, Jobs.jocutoff, Jobs.jotitle, Jobs.jostatus, count(Applications.causer) as "# of Applicants" FROM Jobs, Applications WHERE Jobs.jid=Applications.jid and @emuser="Session("EmployerName")" group by jobs.jid, jobs.joposted, jobs.jocutoff, jobs.jotitle, jobs.jostatus order by Jobs.jid i have passed the value in the "EmployerName" in the session from a text box in another page. i m trying to diplay in a data grid all the above fields where table jobs and table applications jid is equal and the emuser field in Jobs table = to what the session holds. Please help me Thank you Shams
ID increments by one with current year in front of it.   (212 Views)
I am trying to have a auto generated ID field updating by one count with each new record. That part I can do. However I need to put the current year in front of it. I would like to have it in this format. Year-00001 I.E. 2004-00001 would be the first record. Is this possible with SQL Server 2000
Insert into multiple tables   (225 Views)
hi i am using dreamweaver to create a insert record in to a table. but i need to insert the data into two tables. i am a newbie so is there a way to acheive this
Crystal reports query question-   (223 Views)
hi, Im modifying a query for a Crystal Report. The query is for a report. I have 7 fields ,all boolean and the user can pick one or more. It seems that most of the time, only one is selected. I need to add these to the report. Based on the selections they make, I then put the corresponding text value associated with the boolean. I put separate CASE statements in my sql , but Im not going to have room to put those fields in the report. I tried putting them vertically, but the report doesn't look good. Am I on the right track or way off I have the same thing for all 7 fields (below). I managed to squeeze all 7 fields together, making them really small, but when the user has selected something other than the first field displaying on the form, the field appears to the right instead of where it should. How do I do this Not sure about how to do this Another problem I am having is this: I make changes to the report, but when I bring the web page up and select the report, it shows the old report, not the new one. I can't build anything ( I didnt think I had to because the reort is the same ) because I don't have the code-behind - does that matter Can you suggest what I should do
Add data from checkboxes to Access database   (229 Views)
I have a column in Access table which accepts Yes/No values. Now on the web page, when the user checks the check box the same has to be entered into the table column accepting the Yes/No values. How do I do it Thank in advance.
probs getting data in datagrid to load   (289 Views)
hi. i am new to sql databases and am currently trying to get the table to populate with data from the database cnCMS. I have been following the ADO.NET step by step text but, when i compile, i keep getting a blank page. below is the method I am using for when the page loads. any ideas what i might be doing wrong any suggestion much appreciated. thanks in advance. Code: privatevoid BindDataGrid() { string sqlQuery = "SELECT AccountID, UserName, Password, " + "Email, ModifiedDate, CreationDate FROM Account"; cnCMSNET.Open(); SqlDataAdapter daAccount = new SqlDataAdapter(sqlQuery, cnCMS); daAccount.Fill(dsMaster2, "Account"); DataGrid1.DataSource = dsMaster2.Tables["Account"].DefaultView; DataGrid1.DataBind(); cnCMSNET.Close(); }
Policy Management   (199 Views)
I need to create policy to check and see which users have WITH GRANT Permissions on the database.
SQLServer 2008R2 reporting service   (208 Views)
Applogies but this quesiton is related to sql2008 but there not option for that in the above category. Anyway here is my quesiton: While executing the reports for sql server 2008R2 (from VS2010 code). The reporting service's FindItems "rs.FindItems" include one more parameter searchOptions and when I create this object and set it's values, it is always complaining about the value which is being set i.e. Property searchoptions = new Property(); searchoptions.Name = "Report_1"; searchoptions.Value = item.Trim(); it just doesn't like this name and doesn't parse and throws an error "The value for name is not valid" but if I set the name like this: searchoptions.Name = "Name"; it then parse but throws an "Object reference not set to an instance..." error. So the quesiton is what is the valid value for this
How do i display duplicate records   (183 Views)
Hi , Iam running procedure 'spr_example' from sql server management studio and iam using same procedure in the reporting services.But running same procedures in ssms and ssrs giving different results.I have found the problem,in management studio its displaying duplicate records but in reporting services its not including duplicate data. Can anyone suggest me how to display duplicate data in reporting services..
Indexing on Views   (181 Views)
1) We have SQL Server 2005 database on windows 2003 server. 2) What about columns in functions i.e. SUM(ABS(Col1)) OR SUM(Col2 * Col3). We create a view to select these and index on view on its computed AS column Can we directly use vw1.AScol in query in place of these function expressions Will the index be picked and how will cost improvement compare with that of index on normal columns. 3) Can statistics be used in such a situation
Upload server to host   (198 Views)
, How do you upload sqlserver2003 on your hosting account
quick Unicode question   (200 Views)
, I'm using ASP, coded in UTF-8 and connecting to a SQL Server 2000. If I do an INSERT with a stored proc and set the parameter to nvarchar and the datatype of the column to nvarchar, do I still need to prefix the string with N N'mystring' N@mystring or can I leave the N off and what is stored will still be unicode
italicize fonts or italics words   (265 Views)
hello all how to make italicize the fonts or make the words in italics in the following computes: 'W/F: ' + if ( isnull( brand_drug ) , ' ', ' ' + brand_drug ) i only want to make the part if ( isnull( brand_drug ) , ' ', ' ' + brand_drug ) in italics and to maintain the font style for 'W/F: ' cheers!