General Design Question
Jul 20, 2005
Hey
I need to store something a little different in a DB and I was hoping one of
you guys might be able to help me.
Basically it represents a 'world'. I have an initial state and then I get
info like this...
27/11/03 17:21 Mary is born
27/11/03 17:21 Dave is born
27/11/03 17:22 Sean is born
27/11/03 17:23 Peter dies
27/11/03 17:23 Fred is born
I need to be able to run querys like this...
How many people are alive at 27/11/03 17:22
Who was born between 27/11/03 17:22 and 27/11/03 17:23
etc.
Problem is, I'm going to have hundres of 'world's each with thousands of
entrys.
All help is appreciated :)
Tnx
Naomi
View 2 Replies
ADVERTISEMENT
Oct 6, 2006
Okay, I have my idea of how to do this, but would like to get
experience's idea of how to do this since I am a mere 3.5 weeks into
using SQL.I am working on a time off tracker for my company. We
have an employee table (employee), a request table(request). Originally
I was told that all vacation is a lump of days and they take time off
and it is subtracted from their vacation time. Now, I am getting told
they can take off vacation, pto, bereavement and possibly more. I
have a time off table now (time_off) that I made just so I could add
time off types for tracking what time of time off the employee took
based on having one pool of time off. I was thinking I needed to add
another table (tracking) that shows the employee id as a foriegn key to
the employee table then have the table show time off type, accrual rate
(cause some accrue at 2 weeks per year and others at 3 days per year)
and a column for increments cause some they can take in increments of
15 minutes and others half days. My thought was when I create
a new employee, I have put in what types of time off they are allowed,
what the accrual rates for those are. When they take a day off, put it
in the request field and then when they want to view their available
time off, say for the employee, how many vacation days have they
accrued from the tracking database, minus the days they have taken off,
leaves the number of days they have available. I would LOVE
and APPRECIATE your input, cause I don't want to go down this path only
to find out I could have / should have done it differently. One
of the things I haven't really figured out is if they add a new time
off type, how to add it for all the employees and make sure it is
accounted for.
View 2 Replies
View Related
Feb 10, 2006
My general question is whether there is anything to be gained by having 50 tables in one database versus 5 tables each in 10 databases. I have a number of different databases running on a server (SQL Server 2k). The different databases represent different functional groups, for instance car maintenance, cab reservation/dispatch, cab accounting, limo reservation/dispatch, limo accounting, etc. There is some crossover, for instance the cab dispatch system would look to car maintenance to validate the car number entered.A friend who happens to be IT Director at the local university suggested that the server would run more efficiently if there was only one database, rather than the roughly 12 I have now. His belief is that each separate database carries a certain amount of overhead, and combining them into one would be advantageous.Is he all wet, or would there be gains to be made?TIA
View 7 Replies
View Related
May 13, 2015
I have a scenario like below
Product1
Product2 Product3
Product4 Product5
Product1 1
1 0 0
1
Product2 1
1 0 0
1
Product3 0
0 1 1
0
Product4 0
0 1 1
0
Product5 1
1 0 0
1
How to design tables in SQL Server for the above.
View 2 Replies
View Related
Feb 13, 2002
Ok, I'm doing a football database for fixtures and stuff. The problem I am having is that in a fixture, there is both a home, and an away team. The tables as a result are something like this:
-------
Fixture
-------
fix_id
fix_date
fix_played
----
Team
----
tem_id
tem_name
-----------
TeamFixture
-----------
fix_id
tem_id
homeorawayteam
goals
It's not exactly like that, but you get the point. The question is, can I do a fixture query which results in one record per fixture, showing both teams details. The first in a hometeam field and the second in an away team field.
Fixture contains the details about the fixture like date and fixture id and has it been played
Team contains team info like team id, name, associated graphic
TeamFixture is the table which links the fixture to it's home and away team.
TeamFixture exists to prevent a many to many type relationship.
Make sense? Sorry if this turns out to be really easy, just can't get my head around it at the mo!
View 2 Replies
View Related
Aug 18, 2015
I would like to create a table called product. My objective is to get list of packages available for each product in data grid view column while selecting each product. Each product may have different packages type (eg:- Nos, CTN, OTR etc). Some product may have two packages and some for 3 packages etc. Quantity in each packages also may be differ ( for eg:- for some CTN may contain 12 nos or in other case 8 nos etc). Prices for each packages also will be different that also need to show. How to design the table..
Product name :
Nestle milk |
Rainbow milk
packages :
CTN,OTR, NOs |
CTN, NOs
Price:
50,20,5 |
40,6
(Remarks for your reference):CTN=10nos, OTR=4 nos
| CTN=8 Nos
View 3 Replies
View Related
Oct 19, 2005
The following is my code. What I am trying to do is find all the students a teacher as assessed during a give time. Then find out which assessment was done the most recently. After that I will then be aggregating those results. I have never written any pl/sql or T-SQL... heck I don't even know what to call it!The first sql command is doing what I want it to. I can only assume the cursor is working correctly. Any help would be greatly appreciated.BryanALTER procedure Domain@UserID numeric,@StartDate datetime,@EndDate datetime
AS-- Variable DeclerationDECLARE @SessionID varchar(1000)DECLARE @EachSessionID numeric
--Cursor to find all Children that the teacher has assessed for the given timeDECLARE ChildID_cursor CURSORFORSELECT DISTINCT childID FROM capsessionWHERE userid = @UserIDAND sessiondate BETWEEN @StartDate AND @EndDate-- looping through all Children to find there most recent assessment.OPEN ChildID_cursorDECLARE @ChildID numeric FETCH NEXT FROM ChildID_cursor INTO @ChildIDWHILE (@@FETCH_STATUS <> -1)BEGIN IF (@@FETCH_STATUS <> -2) BEGIN DECLARE SessionID_cursor CURSOR FOR SELECT TOP 1 CAPSessionID FROM CapSession WHERE (ChildID = @ChildID) AND (SessionDate BETWEEN @StartDate AND @EndDate) ORDER BY SessionDate DESC END FETCH NEXT FROM ChildID_cursor INTO @ChildIDENDCLOSE ChildID_cursor
OPEN SessionID_cursorFETCH NEXT FROM SessionID_cursor into @EachSessionID SET @SessionID = ''WHILE (@@FETCH_STATUS <> -1)BEGIN IF (@@FETCH_STATUS <> -2) BEGIN SET @SessionID = @SessionID + @EachSessionID+ ',' END FETCH NEXT FROM ChildID_cursor INTO @ChildIDENDCLOSE SessionID_cursorRETURN @EachSessionID
View 3 Replies
View Related
May 30, 2008
Hi, I wanna know if one has to undergo the 'sql video tutorials' on this website before trying to understand data access tutorials, again on this site.
Are the two related by any chance. Also I am not able to find the customer database files he has created in tutorial # 5, dumb to ask, but what to do?,...so anyone willing to shed light!!!
View 2 Replies
View Related
Jan 12, 2003
Hello everyone,
as you might have seen, I'm a total newbie to this Site and M$ SQL.
I browsed the forum to see if there are already matching answers to my question, with no success.
My question:
As a MySQL & PHP user I ask myself if there is a possibility to use M$ SQL the way I use MySQL and PHP!?
Is there a way to generate dynamic websites with M$ SQL 2000 and a webserver running PHP sources?
A brief yes or no would really help me, if you have any links or resources on this topic, I'd be glad to hear about it.
Thanks
Tom
View 2 Replies
View Related
Mar 1, 1999
I get the error "General SQL Error" when reading or writing to a memo field in Sql Server through a frontend build in Delphi 4.
I'm Using the latest BDE.
I have recently installed this onto a NT enviroment in the same manner as my own enviroment but get the error message above.
On my own enviroment and a friends enviroment I do not get any errors.
Can someone please give me some help on this or a direction to run in ?
Thanks
Dave.
View 1 Replies
View Related
Apr 3, 2008
1. What is the SQL error you receive when you try to fetch data from a cursor after it has run out of data?
2. After a SQL statement is executed, what does a negative value in the SQLCODE variable indicate?
View 7 Replies
View Related
Sep 26, 2004
Hi, folks. I've a production SQL machine with more than 20 users making transactions 24 hrs in 6 days a week. I've only Sunday for maintenance. The server has fixed 2 GB RAM allocation for SQL. Is it good to Restart SQL ( or machine) to clear the Buffer-Cache( or is it good to keep the cache) .... :rolleyes:
Howdy!
View 3 Replies
View Related
Mar 16, 2006
:eek: I am not going to lie, I am taking a DB course and am finding it extremely difficult to understand. :o
We are doing Relational DB & ER modeling as well as table normalization.
I only have 1 hour to take an upcoming and know I will score poor on my own.
Anyone want to help me out with my quiz?
I can post the Q's here.
Thanks much
View 14 Replies
View Related
May 3, 2004
Hi! How do you query an entire db for a value?
I know how to do table queries from the SQL Analyzer, but not a full DB search.
Like, if I wanted to find a value '137.51 in a DB, what would I use?
Many thanks!
JJ
View 1 Replies
View Related
Apr 28, 2008
I'm not impressed with the speed/quality of responses from this forum...
Can anybody recommend a more active forum?
View 20 Replies
View Related
Oct 5, 2007
Hi,
is there a search function in MS SQL server 2005 to search for a name of a table or a name of field or entry in a field?
what/how should be the fastest way to do it?
thank you
View 4 Replies
View Related
Mar 11, 2008
Maximum Number of rows allowed in sql server 2005 tables ?
Maximum Number of columns allowed in sql server 2005 tables ?
What are all the built in string functions can be allowed for 'TEXT' DataType in sql server 2005?
View 1 Replies
View Related
Aug 3, 2005
Before I go into specifics, this is my problem. I've have a tablethat gets updated with large amounts of data on a monthly basis.Sometimes (rarely) identical rows of data are on one months import thatalready exist from the previous month. I can identify these rows from acombination of two fields (sampleID and testname).My question is this. Would it be an appropriate 'fix' if I created anew 'formula' field on the table comprising of a concatentation ofthese two fields and then made that an index field (no duplicates)? Myguess would be that if we then tried to import a record with a sampleIDand testname that already existed, then the import for that recordwould simply fail.Would this work? Is there a better way? My background is more withAccess so apologies if I'm not using the right terminology.Simon Harris
View 4 Replies
View Related
Jul 26, 2007
hi...i would like to know best practice when assigning a value to a variableexample belowsetorselectdeclare @var1 varchar(25)set @var1='abc'select @var1='abc'to meset is implicitselect implies conditionsi see both used all over the place here at my new company....so witch is better practicetksMJ
View 6 Replies
View Related
Jul 27, 2007
Is comp.databases.ms-sqlserver more active thanmicrosoft.public.sqlserver.server, or is it the other way around??Which NG is better for general and 'learning SQL 2005' types ofquestions??Thank you, Tom
View 2 Replies
View Related
Jul 20, 2005
New to using databases that are NOT Access. New to MS SQL Server. I'dlike help understanding some concepts.Firstly, I'd like to know how to connect to a database using MS SQLServer on a remote web server using Windows XP; I know the IP and havethe username and password to connect...but what program do I use?Suggestions, appreciated.Secondly, I'd like to make changes to the remote database - anyonesuggest programs to use?Regards,OZ
View 1 Replies
View Related
Mar 28, 2006
I have a general question about transactions and commands that are replicated in a Transactional replication.
My screen shot says:
A total of 5 transaction(s) with 85 command(s) were delivered.
I know what a transaction is, but what is a command?
I am assuming a transaction is
begintrans
committrans, correct?
View 4 Replies
View Related
Sep 21, 2006
I am currently upgrading my companies database from 6.5 to 2000. Including the replication. I am curious about something. Currently we are using the commands in 6.5 to do the replication instead of stored procedures. (except for one table that requires custome filters). When I reestablished replication on 2000, the default is to create stored procs on the subscribers to hande the replication. (sp_MSins_tablename). My question whether anybody knows why it defaults to using sp's? Is there a reason or is that just the way it is. I want to know if using sp's is better than just sing the commands before I change my setup.
Thanks for any responses.
Johnny
View 3 Replies
View Related
Jul 16, 2007
Hello,
Can someone please answer the following questions:
1) Am I correct that SSRS 2005 can access a remote data source on SQL Server 2000? (this one I'm pretty sure about). I'm also trying to determine whether I can move up to SSRS 2008 when it is released and keep running all the same report types against SQL 2000.
2) Where is the bulk of the reporting services calculations performed (e.g. NOT the database query itself)? The Reporter Server? Or the Reporter Server Database?
3) Is it advisable to have the Report Server and Report Server Database on the same server? How do people typically handle this?
4) Is it advisable to have the Report Server and the Datasource database on the same server?
Thanks!
Michael
View 4 Replies
View Related
Apr 19, 2007
I have a website. It is a SAS Site. It has a structure similar to
tbClient (ID, Username, password)
tbData (ID, ClientID, info)
tbDatax(ID, tbDataID, info)
tbDatay(ID, tbDataXID, info)
This is a reporting nightmare for me. I Ihave a sollution, but i was wondering if SRS has an out of the box sollution or if anyone knows of an out of the box sollution.
It is a reporting nightmare because clients want to be able to create reports out of the system, but I can't let them see other clients data.
My sollution is give them a username CLientA
They log into The database with CLientA login
I have views that mask the data by enforcing all of the relationships through the view.
create view vutbDatax as
Select tbDatax.*
from tbDataX
Inner Join tbData on tbData.ID = tbDataX.tbDataID
Inner Join tbClient on tbClient.ID = tbDataX.ClientID
where tbCLient.Username = User
User is a Database function that returns me the Username they logged into the database as.
Imagine doing that for 100 views. And managing the security on it. I have done it and it is in the process of testing right now but Does anyone have a better sollution.
View 1 Replies
View Related
Feb 29, 2008
Hi, I've got the query below which works as needed, but it performs the same inner select twice at present. What is the best way of eliminating the second evaluation of the inner select statement?
SELECT TOP 1 condition FROM
(SELECT condition, COUNT(condition) AS total FROM [JCM].[dbo].[jcmresults] GROUP BY condition)
WHERE total = (SELECT MIN(total) FROM
(SELECT condition, COUNT(condition) AS total FROM [JCM].[dbo].[jcmresults] GROUP BY condition))
Thanks,
Andrew
View 5 Replies
View Related
Apr 14, 2008
I have a website that is probably going to hold a sizable amount of data. The data will be specific to groups of users based on login credentials. Would it be more efficient to create a whole new database for each group of users, or create new tables for the groups in the existing database?
Any thoughts on the topic would be appreciated.
Thanks
View 3 Replies
View Related
Jun 16, 2008
If I have a foriegn Key stored in a primary table, are triggers used to automate routines in the foreign table when ever the foreign key is changed.
Is there a forum reference with practicle examples of where to use triggers?
View 3 Replies
View Related
Apr 20, 2005
Hello.
I'm running into a rather intermittent problem when a search query is run on an ASP.Net web application.
The error is 'General Network Error' Check your Network Documentation...
As I said, it doesn't happen everytime which leads me to beleive that there is a problem with the database connection
There's probably no more than 50-60 max users hitting the app at any one time.
Anybody familiar with this?
View 1 Replies
View Related
Feb 24, 2006
hi guys
i am developing my application on framework 1.1 on asp .net
i am trying to connect to sql server 2005 but it gives me error like general network error check your network documentation.
does any one know how to solve this error then pl reply fast
View 1 Replies
View Related
Mar 8, 2006
Hi all,
I'm new to ASP2.0 development (not new to programming though) and have been grappling with general paradigm questions.
So far, I'm using a SQL database to store my applications data. On UI front, I've been using the SQLDataSource in combination with a gridview control. VS2005 thus far has been really easy to use when it comes to these controls. However, I see myself having to know knowledge of the database in UI layer which screams as a classical mistake.
The right thing to do seems to be to have an intermediate layer, an object model, abstracting the database. However, if I do create an object model representing tables in my database and then expose these to the UI layer, I lose the ability to easily display data in my gridview (i will no longer be using a sqldatasource.
So, after much run around my question is this, what is the preferred paradigm when programming applications for ASP.NET 2.0 and can you still use the nicities offered by VS2005?
Thanks
-Aleem
View 1 Replies
View Related
Dec 26, 2001
Over the course of many weeks the frequency of the following error has been occurring. I have been trouble shooting this problem since I started with the company some 3 weeks ago and I am just stumped.
I'm running SQL7/SP3 on NT4 with current SPs and hotfixes. My default library is NamedPipes with an alias allowed for TCP/IP.
Any help or leads would be appreciated. I've checked for everything the MS KB suggests and it still hasn't resolved my problem!
example of the error:
Microsoft OLE DB Provider for SQL Server error '80004005'
[DBMSSOCN]General network error. Check your network documentation.
/dir/file.asp, line 29
THANKS!
Kim
View 6 Replies
View Related
Jul 2, 2006
Hi
Would you say that it's ok for a web site code to make ALL of it's access to a db through SP and views? And I mean everything including inserting new records and updating others with no use with SQL in the code.
The advantage would be very strict control over the access, but in order to achieve this it would take many many SP and views to cover all types of actions, can you think about a disadvantage except all the work creating those SP?? what about the server resources and performance? how demanding it would be?
Thanks,
Inon.
View 7 Replies
View Related