With respect to my (now not so recent) thread on Concurrency, I would like
to run my idea past you gurus to see if its a runner. First, a brief recap:
I have a single user system (one user, one copy of the software, one copy of
MSDE, one machine) that I wish to convert into a multi-user/single database
networked system. The problem I had was that a lot of information is
fetched from the database and cached in the client program (the program
implements a tree structure, similar to a file system, and each of the nodes
in the system has properties). The concurrency issue revolved around having
multiple users updating these properties and possibly able to modify the
tree structure and there being no way to notify the other clients that they
need to refresh their data structures. Consider the system to be similar to
VSS to look at (and in VSS, people can make modifications to the tree
structure also!).
Ok, one of the suggestions was time stamping each record. So, when one user
modifies the record, a second user can detect whether their timestamp is
different and thus whether or not their update is invalid (and also whether
or not the client program needs to refresh the properties of the given
node). How about instead of a timestamp I simply use a reference counter.
ie. an integer that increments every time the record is modified (same
principle). I don't need to know when it was changed, just that the two
reference counters are different between when I fetched and when I am
updating the record.
Secondly, I think I have to distinguish between a change in properties and a
change in structure. For example, User A doesn't need to know about a
change in properties for a node he is not currently looking at. However,
that same user will want to be told about any change to the overall tree
structure. So, I was thinking that any operations involving modifications
to the tree structure should set a "structure changed" flag in the database
(increment a counter). After any operation is performed, the client
compares its "changed" flag to the database value to see if it needs to
reload the tree structure.
i have a table FORUM_REPLY it contain follwing fieldsquest_id,answer_id, reply_user_id.i want who is post most answer.so i need reply_user_id and max(no_of_answer).but following query given reply_user_id and no_of_answer onlySELECT reply_user_id,count(answer_id) as no_of_answer FROM FORUM_REPLY GROUP BY(reply_user_id)How to get max_no_of_answer?
I am new to the DTS game - or at least to trying to do anything other than transfer rows between databases with identical structures.
I now need to create a far more complex DTS package to transfer data between an SQL Server database (I am using SQL Server 7.0) and an Oracle database. I have no trouble in making the connections and performing simple DTS's beween the two.
However, my current task is more complicated.
Problem 1: In one database I would store fifty values as 5 five records each containing 10 values (i.e. has ten fields). However, in the other database these fifty values would all be stored as one record (i.e. one row with 50 fields). How could I go about creating a DTS to transfer this information?
Problem 2: These values should only be transfered if certain conditions are met in an another unrelated table. For example, a flag in another table indicating that transfer of the said values should occur.
Any help with either of these problems would be much appraciated.
When one of the users log into the database via a thrid party application they receive an error message:
2000/11/16 10:40:13.84spid51Error : 605, Severity: 21, State: 1 2000/11/16 10:40:13.84spid51Attempt to fetch logical page 7832 in database 'highview' belongs to object '1241055457', not to object 'application_data'. 2000/11/16 10:45:07.68spid46Getpage: bstat=0x1008/0, sstat=0x80002110, disk 2000/11/16 10:45:07.68spid46pageno is/should be:objid is/should be: 2000/11/16 10:45:07.68spid460x1e98(7832)0x49f900e1(1241055457) 2000/11/16 10:45:07.68spid460x1e98(7832)0x4810b86f(1209055343) 2000/11/16 10:45:07.68spid46... extent objid 0, mask 0/0, next/prev=0/0 2000/11/16 10:45:07.68spid46... retry bufget after purging bp 0x2da7e060
I tried running DBCC checkdb, newalloc,& checktable to fix the probelm and than droping the table and rebuilding it but not success, any suggestion are more than welcome.
If anybody can suggest the most efficient way to "page" the output from a big and wide table (about 7000000 records) in order to display on the web in the user requested sort order. Sort order could be on at least 7 different columns from 50 of returned.
I need to find a solution to move to the next and previous page.
what if I took this trigger and based it on a view rather then a table
CREATE TRIGGER TerminationUpdateTrigger ON EmployeeGamingLicense FOR UPDATE AS INSERT INTO TERMINATION(Status,[TM #],LastName, FirstName, [SocialSecurityNumber], DateHired, Title) SELECT STATUS, [TM#], LASTNAME, FIRSTNAME, [SSN#], HIREDATE, JOBTITLE FROM Inserted WHERE STATUS = 'TERMINATED'
CREATE VIEW dbo.Update_Terminations AS SELECT STATUS, TM#, LASTNAME, FIRSTNAME, SSN#, HIREDATE, JOBTITLE FROM dbo.EmployeeGamingLicense WHERE (STATUS = N'TERMINATED')
Base the Trigger on this View rather then on the Table itself????
The question is :- Which academics have the largest number of fields of interests? Return their academic number, given name, family name, institution and total number of fields they are interested in. Your must use a subquery in the sense that you must use 2 sql statements and use any of the following to connect both:-
I have a table call CLIENTE and another table call ENDERECO where the CLIENTE table has the FOREIGN KEY of the ENDERECO table.
When I try INSERT COMMAND in C# this message is show.
The instruction INSERT conflicted with a constraint of FOREIGN FUNDAMENTAL "FK_CLIENTE_ENDERECO." The conflict happened in the database "E:ARQUIVOS DE PROGRAMASMICROSOFT SQL SERVERMSSQL.1MSSQLDATALINETEC.MDF", table "dbo.I ADDRESS", column 'IDENDERECO.' The instruction was concluded.
I have number of tasks in my control flow most of them are execute sql task. I want to update one of the column in my table when anyone of the task in the control get fails?
Please let me know if anyone have an idea how to do this.
Dear Friends,I'm a junior DBA, I've to prepare an online examination. for this, I've three categories. a)beginer level b)intermediate level c)expert level
again here subjects are 6. like sqlserver,oracle,c#,vb.net,html,javascript. in these subjects, i've to select these three types of questions. now how can i design for this requirement? shall i create three tables for beginer, intermediate,expert or shall i create 6 tables and write according that?
Hi guysWe have a following problem. For security reasons in each table in ourDB we have addition field which is calculated as hash value of allcolumns in particular row.Every time when some field in particular row is changed we create andcall select query from our application to obtain all fields for thisrow and then re-calculate and update the hash value again.Obviously such approach is very ineffective, the alternative is tocreate trigger on update event and then execute stored procedure whichwill re-calculate and update the hash value. The problem with thisapproach is that end user could then change the date in the tables andthen run this store procedure to adjust hash value.We are looking for some solution that could speed up the hash valueupdating without allowing authorized user to do itThanks in advance,Leon
Having no more experience than reading books online, here is an interesting idea I would like to run by you guys and you can let me know if it is feasible or tell me I need to put the crack pipe down...
We are going to increase the number of disks in our SAN, and I was speaking with the SAN administrator and he mentioned the shuffling of logical drives to match the new space. He said he is going to have to go through quite a few combinations/permutations on figuring out the best configuration for what data goes on the old vs. new to get the optimal space.
Is this something that can be modeled out? I can write something that recursively figures it out, but why not explore fun ideas with tools that may be able to do it?
aspnet_wp!resourceutilities!5!07/11/2007-10:32:00:: i INFO: Reporting Services starting SKU: Developer aspnet_wp!resourceutilities!5!07/11/2007-10:32:00:: i INFO: Evaluation copy: 0 days left
Hi, I have a table that has the ff: LastName varchar(50) FirstName varchar(50) PhotoPath varchar(50) Now I want to create a form that can accept the LastName,Firstname and also can upload a picture which in turn the filename of the image will be the value for the PhotoPath field, and eventually displays it using the repeater control. Your Help/Info. is highly appreciated...
Last night, I have this idea, but can not know if it can have a good performance and efficiency when the @CurrentPage is big.-------------------------------------------------------------------DATABASE:AdventureWorks DECLARE @CurrentPage intDECLARE @PageSize intDECLARE @OrderExpression nvarchar(100)DECLARE @Sql nvarchar(500)SET @CurrentPage = 1SET @PageSize = 10SET @OrderExpression = N' employeeid 'DECLARE @BigTop intDECLARE @SmallTop intSET @BigTop = @CurrentPage * @PageSizeSET @SmallTop = (@CurrentPage -1) * @PageSizeDECLARE @StartTime datetimeSET @StartTime = GETDATE()SET @Sql = N' SELECT TOP (' + CAST(@BigTop AS nvarchar(10)) + ') * FROM humanresources.Employee '+ ' EXCEPT '+ ' SELECT TOP (' + CAST(@SmallTop AS nvarchar(10)) + ') * FROM humanresources.Employee ORDER BY ' + @OrderExpressionEXEC sp_executesql @SqlDECLARE @EndTime datetimeSET @EndTime = GETDATE()SELECT DATEPART(s,@EndTime-@StartTime)SELECT DATEPART(ms,@EndTime-@StartTime)GO-----------------------------------------------------------------
I have a complex select statement that is used in several stored procedures. I decided that instead of having x number of T-SQL scripts with the same exact select statement that I would to put this query into a view and then do a select * from View. Recently an instructor told me that this was a bad idea and that anyone who uses a select * from anything should be fired. When I asked for his reasoning his response was to say the least abnoxious. I can understand why a Select * from Table might be a bad idea as the table definition can change, but the chances of a view changing seems much less likely. Is a view a good idea in this case? Is the Select * from View really a bad idea? Thanks
I am looking for a good reference on hardware specs for a dedicated SQL server. I don't want to talk to vendors, because I'm not looking to get snowed. Does anyone know of any resources? The server is to be a dedicated dataserver, for about 300 clients.
Can anyone tell me if turning on the AUTO_UPDATE_STATISTICS option will have any adverse effects on performance? I've read that it is possible for it to adversely affect performance, because SQL Server “takes a quick break to update database statistics in the middle of the day”. The book does not explain why and I'm always leery of simply accepting something, simply because I’ve read it from a book. This is the first time that I’ve ever heard this and cannot find anything from SQL BOL or any other source.
Hi.. Never used MSSQL 2000 db. I have this website that uses mssql2000. I want to export it and convert db in mysql. Please help me understand how i can do that. I have all login info..
Hi, all.. One database called POS in a server A is replicated with another server B with merge replication.
Server A is distributor and publisher. I tried to replicate POS db it keeps giving me error following.
"SQL Server Enterprise Manager could not retrieve information about database 'POS' Error 21776: [SQL-DMO] The name 'POS was not found in the ReplicationDatabase collection. If the name is a qualified name. user [] to separate various parts of the name, and try again."
When other try it gives following error.. SQL Server Enterprise Manager could not enable database 'POS' for merge replication. Error 20736: [SQL-DMO] This object has been dropped from the server.
I did all I can do.. I reinstalled sql server and tried again.. but it gives same error..
Good morning In messages system i have table to store messages and another table to contain the links which the message is posted through Now i want to delete a link but i don't want to delete the message sent through this link The problem: When displaying the message sent what will be found in the link field (i.e. for the deleted link)
If any one has a good idea for doing that please reply to me I don’t want the sql code I want just the idea Thanks
I have about six different entities that can have zero or more note entities associated with them. The easy way to do this is obviously to have a different "note" table for each of the entities i.e. WorkItemNote, CustomerNote etc.. But I would much rather have a single "note" table since they would all be identical, so I came up with this design:
CREATE TABLE WorkItem ( WorkItemGuid uniqueidentifier PRIMARY KEY DEFAULT (newid()), -- rest of table declaration removed for bravity )
CREATE TABLE Customer ( CustomerGuid uniqueidentifier PRIMARY KEY DEFAULT (newid()), -- rest of table declaration removed for bravity )
CREATE TABLE Note ( NoteId int IDENTITY(1,1) NOT NULL PRIMARY KEY, ReferenceGuid uniqueidentifier NOT NULL, Text ntext NOT NULL, -- rest of table declaration removed for bravity )
This way I can get notes associated with a given entity, either Customer or WorkItem, by just selecting from the Note table with its WorkItemGuid or CustomerGuid.
My question is: Is this the best approach to what I am trying to accomplish?
(ps: Apologies if "many to one" is not the right terminology)
Good morning In messages system i have table to store messages and another table to contain the links which the message is posted through Now i want to delete a link but i don't want to delete the message sent through this link
The problem: When displaying the message sent what will be fount in the link field (i.e for the deleted link) I tried to move the deleted link data to separate table (EX: deletedLink) but if the user added new link with the same name as the deleted link? The problem mainly in when displaying the message sent i will have the same link twice one for the deleted and the other for the added one.
If any one has a good idea for doing that please reply to me I don’t want the sql code I want just the idea Thanks
we are creating a database of sales agents. Basically I have a tableof about 35,000 people, a second one with 8000 offices, and a thirdtable of around 400,000 transactions done by those 35,000 people inthose 8000 offices. We get new data everyday that just updates theexisting tables with the updated rosters and transactions.I want to build a quick website where our recruiters can look up thosepeople and keep contact info and all that fun stuff but also pullnumbers on those people. Like* How Many Transactions that Sales Agent did last year* Rosters by office showing productionThe goal is to click the users name and see all the percentages,commissions and data like that which we will get by searching thattable of transactions by the agents ID.the problems I see right away are stuff like* If I were to pull a report showing all agents in a single office withtheir number of transactions next to their name, that is a HUGE query.It would have to search the 400k worth of records for each of theagents on just that one report.A suggestions I was givenI was told by a fellow programmer a better way to do this is to have anadditional table that houses stats info and have the SQL server runautomated reports everyday at say midnight where it updates that table.This table could show stuff like** number of transactions for each user** avg sales price on all transactions for each user** avg commission on transaction for each userlet me know your thoughtsthanks in advanceMonkey Girl
Hi everybody,I need to understand how concurrency excatly work in asp.net. For example, I'm confused what happens if two users at the same time try to access the same record in a table or even the same variable. Do ASP.NET handle this , I mean by locking one user and letting the other to have access OR it's up to the programmer to write some code to lock shared resources such as database , objects and variables?If it's up to the programmer to do this task, I appreciate if you can show me an example that clarifies that.Thank you
Following on from a thread I started about "concurrency" (real-time-ishsystem), I thought I would play about to see if I could easily adapt my datamodel to take account of potential multi-user write conflicts. So, I wouldappreciate you checking my logic/reasoning to see if this kind of thingwill work. Below I have a stored procedure that will simply delete a givenrecord from a given table. I have appended a "_Written" counter to thecolumns of the table. Every time the record is written, the counter isincremented. Clients store the current _Written count in their objects andpass this in to any write procedure executed.The procedure explicitly checks the _Written count within the transaction tosee if it agress with the written count passed in by the client. If it doesnot, the client throws an error. Note I am explicitly checking the_Written count precisely so I can determine exactly why this operation mightfail, rather than checking @@ROWCOUNT after an update.Thanks.RobinCREATE PROCEDURE dbo.proc_DS_Remove_DataSet@_In_ID INTEGER,@_In_Written INTEGERASDECLARE @Error INTEGERDECLARE @WRITTEN INTEGERBEGIN TRANSACTIONSET @Error = @@ERRORIF @Error = 0BEGINSELECT @WRITTEN = _Written FROM MyTable WHERE ID = @_In_IDSET @Error = @@ERRORIF @WRITTEN <> @_In_WrittenBEGINRAISERROR ('10', 16, 1)SET @Error = @@ERRORENDENDIF @Error = 0BEGINDELETE FROM MyTable WHERE ID = @_In_IDSET @Error = @@ERRORENDIF @Error = 0COMMIT TRANSACTIONELSEROLLBACK TRANSACTIONRETURN @Error
Do single commands (or stored procedures) execute concurrently, or they are executed one by one. How do you perform a lock during the execution of a command (or stored procedure).
When I try to amend a stored procedure, I get Error 208: invalid object name when amending a stored procedureAny idea how I can amend the stored procedure?thanks
What would happen if I dropped the distribution db?
I'm having problems configuring distribution and after searching, I found someone that claims they solved the same problem by dropping the distribution db. The resolution is the last post on this thread: http://www.ureader.com/msg/11563430.aspx
Is this safe to do? There are currently no publications and the distribution server is not configured.
I've been asked to document an application and I'm going through allthe Stored Procedures and trying to work out what they're supposed todo.Can anyone give me an idea of what the Stored ProcedurewsBookingListsGetAll below is trying to achieve? Is it incomplete? Ican't see any reason to pass in the Parameter, and what is the UNIONSELECT 0 all about?Many thanksEdwardCREATE Procedure wsBookingListsGetAll@DebtorIDvarchar(15)Asset nocount onSELECTfldBookingListIDFROMtblWsBookingListUNIONSELECT 0returnGO/* Table def */if exists (select * from dbo.sysobjects where id =object_id(N'[dbo].[tblWSBookingList]') and OBJECTPROPERTY(id,N'IsUserTable') = 1)drop table [dbo].[tblWSBookingList]GOCREATE TABLE [dbo].[tblWSBookingList] ([fldDebtorID] [char] (15) COLLATE Latin1_General_CI_AS NOT NULL ,[fldBookingName] [varchar] (50) COLLATE Latin1_General_CI_AS NOT NULL,[fldAddressCode] [char] (15) COLLATE Latin1_General_CI_AS NOT NULL ,[fldEmail] [varchar] (250) COLLATE Latin1_General_CI_AS NOT NULL ,[fldFirstName] [varchar] (100) COLLATE Latin1_General_CI_AS NOT NULL ,[fldLastName] [varchar] (100) COLLATE Latin1_General_CI_AS NOT NULL ,[fldBookingListID] [int] IDENTITY (1, 1) NOT NULL ,[fldInvoiceNumber] [varchar] (15) COLLATE Latin1_General_CI_AS NULL ,[fldPayeeID] [char] (15) COLLATE Latin1_General_CI_AS NULL) ON [PRIMARY]GO