Codes represent different skills of people, example the sort of job functions theyve held in their employment. Like:
t-CEO,
t-CFO
t-Founder
etc.
people, clearly holds data about people.
CodedPeople holds data about which people are coded. So person1 can be coded as t-CEO as well t-Founder, and person2 coded as t-CFO
What I need is a query that returns all distinct people records and takes a number of codeNames as input. So if I throw in t-CEO OR t-Founder I get person1, again if I define t-CEO AND t-Founder I get person1.
However when I add t-CEO OR t-CFO I get person1 and person2 but when the query takes t-CEO AND t-CFO I get no result.
I cant seem to come up with anything that would give me a good starting point. Is there a design fault here? All opinions are much appreciated, thanks in advance!
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:
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!
Hi, I'm using SqlServer 2000 at a web host, and share this db with about 200 others (it's an inexpensive web host so I guess there is not very much traffic on most of them, but I can only see their db IDs so I don't know what organisations they are or the urls they have). Usually, my web site runs fine, but lately it's really really slow (as in non-functioning in reality). I'm in the middle of coding my seach functionality, so I fear that I'm causing this myself. ;-) However, there are only ten posts in my test db, so it should be a piece of cake for SqlServer. The other .aspx pages runs rather slow too now, but when I start a programming session they have worked fine (this has happened three times now so I don't know what to conclude). When the server slows down, it can stay down for hours. I've also tried to access my site from other computers but get the same result, so I guess it has nothing to do with caching (I also tried emptying my browser's - IE7 - cache). I have several asp web sites with Access dbs at the same web host, and they all work fine. In addition, I have no problem viewing and editing my db at the web host via SqlServer Management Studio Express. What do you think of this problem? Should I go for a more expensive web host? Should I give them the "It's not you, it's me" speech? ;-) Or is it really me? Below's my search code, and as you can see, there are some integers there to make sure the loops don't run ad infinitum. I don't really think the problem actually lies with my search code, as everything worked well a week ago, but I don't know... BTW, if you think my code can run much faster without getting too tricky, please let me know. Please help! Pettrer If Page.IsPostBack Then Dim soktext As String = Trim(SokTextBox.Text) + " " Dim tillagg As String = "" Dim varv As Integer = 1 Dim loopvarv As Integer = 0 soktext = Replace(soktext, vbCrLf, " ") 'vbCrLf = mellanslag i VB-terminologi Do While InStr(soktext, " ") And varv < 100 soktext = Replace(soktext, " ", " ") loopvarv += 1 Loop While Trim(soktext).Length > 0 And varv <= 20 'Loop för att identifiera ord och lÀgga till dem i sqlsatsen, ett i taget Dim icke As String = " "
Dim ordet As String = soktext.Substring(0, soktext.IndexOf(" ")) 'Det godkÀnda ordet lÀggs till i tmp-strÀngen soktext = soktext.Remove(0, soktext.IndexOf(" ") + 1) 'Tar bort det som just anvÀnts (eller varit för kort) If ordet.Length > 1 Then 'Blanksteg och ensamma bokstÀver förhindras att komma med i sql-satsen If ordet.StartsWith("-") Then 'Det Àr ett minusord icke = " NOT " 'I sqlsatsen blir det alltsÄ AND NOT (...) ordet = ordet.Remove(0, 1) 'Tar bort minusttecknet frÄn sökstrÀngen End If tillagg += " AND " & icke & " (artistnamn LIKE '%" & ordet & "%' OR " & _ "beskrivning LIKE '%" & ordet & "%' OR " & _ "kulturhemvist LIKE '%" & ordet & "%' OR " & _ "kontaktnamn LIKE '%" & ordet & "%') " End If varv += 1 End While Dim kat As String = "" If KategoriDropDownList.SelectedValue <> 0 Then kat = " AND (kategori1 = " & KategoriDropDownList.SelectedValue & _ " OR kategori2 = " & KategoriDropDownList.SelectedValue & _ " OR kategori3 = " & KategoriDropDownList.SelectedValue & _ " OR kategori4 = " & KategoriDropDownList.SelectedValue & ") " End If Dim lan As String = "" If LanDropDownList.SelectedValue <> "alla" Then lan = " AND lan = '" & LanDropDownList.SelectedValue & "' " End If ResultatDataSource.SelectCommand = "SELECT DISTINCT TOP 200 folknuID, kategori1, kategori2, kategori3, kategori4, initial, artistnamn, lan, kontakthemsida, kategori1, (COALESCE(audio1,'') + COALESCE(audio2,'') + COALESCE(audio3,'')) As audio, (COALESCE(video1,'') + COALESCE(video2,'') + COALESCE(video3,'')) As video, (COALESCE(pressbild1,'') + COALESCE(pressbild2,'') + COALESCE(pressbild3,'')) As pressbild " & _ "FROM Mytable " & _ "WHERE shown = 1 AND shownadm = 1 " & _ tillagg & _ kat & _ lan & _ "ORDER BY initial" ResultatLabel.Text = "SelectCmd: " & ResultatDataSource.SelectCommand ResultatGridView.DataBind() End If '*** pÄ sökkoden
We are setting up a new SMS (SP3) primary server with local SQL 7.0 (SP3) and are mandated to use the following configuration for hard drives:
C:&D: are on mirrored 18GB drives (2 channel RAID controller)
C: OS (8GB) partition D: pagefile & temp (10GB)
E:&F: are on RAID 5 (3x36GB) 72GB useable (2 channel RAID controller)
E: temp data for field techs (10GB) F: SMS & SQL (62GB)
We would like to have the SQL logs on a different physical drive than the data (for improved performance), so we are planning on putting it on drive D:
We realize this will affect redundancy, but should this be a big concern?
When I open my Computer Management Console and look at Event Viewer/Application, I see an error:
Fault bucket 277816039.
For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp. Data: 0000: 42 75 63 6b 65 74 3a 20 Bucket: 0008: 32 37 37 38 31 36 30 33 27781603 0010: 39 0d 0a 9..
What is this error and how can I fix it?
Also, When I click on the link to get more information all I get is a page that says there is no information on this error. This happens with ALL my errors! I have never seen any usefull information from this link.
I am running on a Windows 2004 Standard Server with SQL Server 2005.
I just installed SQL7.0 on a windows 98 machine. When I go to register a new database, I get the following message. MMC caused a general protection fault
I have rebooted the machine, removed & reinstalled the application.
We have to setup a SQL 2000 box (it's what the app requires) and I would like to know what is considered the best practice for setting up the drive fault tolerance.
We are looking at allocating about 500GB for both system and data drives.
I,m having a problem with something that worked well just recently. maybe I changed a setting by mistake.
I have a Database grid view on my page. When I configure my data sourse and get to "configure the select statment " on the wizard and press advanced to open the wizard with two check boxes " generate INSERT, UPDATE etc and the other check box "Use optimistic concurrency " this input box of the wizard is greyed out (non responsive)
My raid-5 server failed because one disc, some folders and files are lost, but I have recoverd whit some software for the propuse.
I have reinstaled the SQL server and attached the database, but when I try to open the tables I recieve a error message saying : internal consisty error... somethihg like this.
but I can't figure ou how to "remove" the RSClientPrint Class add-on in IE 6.
P.S. Why does something as simple as printing need to be an ActiveX control? There are all kinds of issues revolving around pushing this out using SMS for users without local admin permission.
Hi, I have a table Projects. This table has ProjectID and Version as PK. The Version starts at 1 and everytime a project is changed, I save the project with the same ProjectID and increase the Version by 1.How can I create a query that get all Projects with the latest Version? Thx
I have a Properties table like thisPropertyID PropertyValue 1 Address 2 City 3 Stateetc.and a UserProfile table like thisUserID PropertyID PropertyValue1 1 123 Main Street1 2 Denveretc.How do I write a query that can populate a registration page with Address,City, State as labels and 123 Main Street, Denver, as TextBox text?
Hi,I have included here my webform here.i need some assistance here with code.my webform contains two parts.the 1st part is office info and the 2nd part is client info.i also have two table named office_info and client_info.1st part is populated from the table office_info as soon as the office name is chosen from the dropdownlist.in my scenario,when user selects officename from dropdownlist,then textboxes correspondingto address and email gets populated by the related data from table office_info.2nd part is client info.here there are 3 textboxes(for name,age,address) to collect the data from the client using the form.these data gets posted to new row in table client_info as soon as user clicks on the save button.Now my actual question starts here.when user selects the option from the dropdonwlist the office info displays,now when he fills the client info part and clicks the save button,i want all the data to go to the table client_info in such a way that all the data fromthe client info part plus the id of the office also go along with it.eg: when user clicks the save button.i want data to get submitted in table client_info in this way.(id,name,age,address,off_row_id) (1,jack,25,US,1) here off_row_id is the id from the below table.my table office_info is like this (id,off_name,address,email) eg(1,xyz,ny,xyz@xyz.com) well can anyone tell me how to write query to do insert,edit,update,delete query in this case using c# and sql?here is the scenario <%@ Page Language="C#" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server"></script><html xmlns="http://www.w3.org/1999/xhtml" ><head runat="server"> <title>Untitled Page</title></head><body> <form id="form1" runat="server"> <div> Office Info:<br /> <hr /> <br /> Office name: <asp:DropDownList ID="DropDownList1" runat="server" Width="63px"> <asp:ListItem>ABC</asp:ListItem> <asp:ListItem>XYZ</asp:ListItem> </asp:DropDownList><br /> <br /> Address: <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br /> <br /> email: <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br /> <br /> <hr /> </div> Client info:<br /> <br /> name: <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox><br /> <br /> age: <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox><br /> <br /> address:<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox><br /> <br /> <br /> <hr /> <asp:Button ID="Button1" runat="server" Text="save" /> <asp:Button ID="Button2" runat="server" Text="cancel" /> </form></body></html> thanks.jack.
hello everyone. i want to know how asp.net works with sql database. can i have a link to the article where i can perform from basic to advance sql query using asp.net(C#)? (in context of vwd 2005 and sql express ) thanks. jack.
I have two table named tbl_Scale and tbl_NGTrDAMaster tbl_Scale(ScaleID,ScaleName,ScaleLB,ScaleUB,ScaleSI1,ScaleSI2,ScaleSI3) here scale id is prim key tbl_NGTrDAMaster(TrDaId,ScaleID,CityTypeID,DAAmount) no prim key and we get CityTypeID from xml databinder....... In my form thr is two drop down list one for scale name and another for city type id this is the data form tbl_NGTrDAMaster 17 1 1 555 18 3 1 777 19 3 1 999 8 1 1 777 5 5 1 34634 20 1 1 52352 27 1 1 6666 23 5 1 12412 12 2 1 235235 13 3 1 456456 14 5 1 1000000 15 4 1 60000 16 5 1 90 24 5 1 25123 25 5 1 13124 26 5 1 12412 but i am expecting only one combination of set..... like 1-1,1-2,1-3,1-4.......but if reenter 1-1 thn we have to restrict that.... please help me.... i am in big trouble......Thanx in advance If my qes is not clear for everyone... plz tell me.... i try my lebel best for understand my prob to u.....
Hello, I have a table with fields; T1: Dept, Name, Desc, ModificationDate How can I group by T1.Name, T1.Desc and bring T1.Dept which has the latest T1.ModificationDate Can anyone write me this query?
I have got the three tables above. Would you help me to write a SQL query to show the names and PercentOfQuota of sales people who have an order with all cuatomers. Thank you very much!
I have got the three tables above. Would you help me to write a SQL query to show the names and PercentOfQuota of sales people who have an order with all cuatomers. Thank you very much!
i am assuming there is a better way to write this query (since im not too proficient in SQL)
sql Code:
Original - sql Code
select client_id from clients where client_id not in (select schedule_det.client_id from schedule_det, schedule_mstr where schedule_det.schedule_id=schedule_mstr.schedule_id and schedule_mstr.status_code!='COMPLETE')
SELECT client_id FROM clients WHERE client_id NOT IN (SELECT schedule_det.client_id FROM schedule_det, schedule_mstr WHERE schedule_det.schedule_id=schedule_mstr.schedule_id AND schedule_mstr.status_code!='COMPLETE')
these table have some common feild names. table1,2 and 3 all have a,b,c and d as field names. each table has other field names too but the ones they all have in common are a,b,c and d.
so i would like to write a query that returns all rows from all 3 tables where column d is greater than 5 and less than 10.
so basically i want it to treat the records from all 3 tables ad one big dataset.
how would i write a query to do this.
i know i could say: SELECT a,b,c,d FROM table1,table2,table3
but what gets me is the WHERE clause
do i have to say WHERE table1.d >5 AND table1.d <10 OR table2.d>5 AND table2.d <10 OR table3.d>5 AND table3.d <10
Insert into Ename Select 'a' Union all Select 'a' Union all Select 'a' Union all Select 'b' Union all Select 'c' Union all Select 'b' Union all Select 'd' Union all Select 'g' Union all Select 'g'.
Hi i want to audit a tables For That i created audit tables In that table i want to store data as all field related to old data table and from which system user had changed the data
For this system id i used host_id() but the iam not getting the id
I have a table with many records in it. There is one field called "Nature". How would I select the value that appears the most often in the "Nature" field? The nature field contains text.
For example, this code selects those with more than 10 records...
I just want the top record.
SELECT count(*) FROM WEBASGN_FULL GROUP BY NATURE HAVING count(*) > 10
Basically select nature from webasgn_full that occurs the most often in the table....
I need help on writing a query which will return my results as I need them.
I have three tbls.
TimeType, TimePlan and TimeSpent
TimeType simply lists the Individual Jobs (types) a user can be doing.
The TimePlan and Time Spent each list individual records with start and end dates and what TimeType was being performed. Each TimeType can have multiple starting and ending dates for the TimePlan and Timespent.
I need my results to show individual timetypes, with the starting and end dates for the Timeplans and also the TimeSpent
So there will be multiple Types, and for each one I need to show the start and end dates.
I would normally write this as three seperate queries.
The first would get the TimeTypes, The second the TimePlan starting and ending dates for that type, The third , the Spent starting and ending dates for that type
However that doesn't come across as very efficient so I wonder if there was any other alternative
Bellow is my requirement I have employee table which stored employee information And I have reference table which holds information for that employee reference
I need to count from the reference table like how many reference made for male Employee and female depending on their age range
I have a selection list: Gender: Male Female All
When user select : Male from the list
Male Female Age range: 20-29 Age range: 30-45 120 0 100 20
When user select : Female from the list
Male Female Age range: 20-29 Age range: 30-45 0 25 15 10
When user select : All from the list
Male Female Age range: 20-29 Age range: 30-45 120 25 115 30
Please help me to sort out this problem regards Sujithcf
I have a Table "T1" with col "id","name". Table "T2" with "TID","ID" etc..d [Here, id of T1 is mapped to id of T2]
Now, I wanted to write a query such that the query should output T1.id,T1.name and a third column which will show me the count of records in T2 corresponding to an ID in T1.
I run into this question again. Here is it. I have two tables like this: StoreVisit(StoreVisitID(PK), UserID, StoreID, LoginID, LogoutID) ProductOrders(ProductID, UserID, StoreID, OrderQuantity, StoreVisitID) What I want to do is, I need to find out the lastest store visit record and put the StoreVisitID into ProductOrders table for the same userID, StoreID. So what I tried is:
update ProductOrders set StoreVisitID=sv.StoreVisitID from ProductOrders po inner join (select top 1 * from StoreVisit where UserID=po.UserID and StoreID=po.StoreID order by StoreVisitID desc) sv on po.StoreID=sv.StoreID and po.UserID=sv.UserID Where po.UserID=@UID and po.StoreVisitID is null
When I run it, it shows the error: The column prefix po, does not match with a table name or alias name used in the query. Looks like it does not recognize the po in select top 1... .
I hope you guys already understand what I am trying to do. I am wondering what is the best way to do this? Thanks.
I've some really big problems with SQL Server 2005 Express. I Recently, I had 2 instances on my machine, one was a SQL Server 2000 Developer and the other a 2005 Express Version. The 2000 version was not necessary anymore, so I unstalled it, since then, the Express version keeps having probems.
Under the Server Properties -> Database settings -> Database Locations I've changed the path to D:sqldatamssql, but now, the programm always takes the "C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLData" to store and load the databases, no matter what I do.
And there are more problems see here:
Restoring does not work======================= I wanted to restore a database called "fw40_admin" from a backup file (.bak), but that didn't work at all, it always says this as an error:
"System.Data.SqlClient.SqlError: The operating system returned the error '5(error not found)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'D:sqldatamssqlfw40_admin.mdf'. (Microsoft.SqlServer.Express.Smo)"
But as soon as I type in the installation path "C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLData" inside the "Restore As" under "Options", it works.
Why does the backup only work in "C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLData", BUT the database locations under the server properties is indicated with "D:sqldatamssql"????
Attaching does not work======================= Attaching an existing database does not work either. Most databases (mdf) are located on the path D:sqldatamssql, but as soon as I press
Attach Databases -> Add
The dialog window appears with the "D:sqldatamssql" path, but it is unable to find any *.mdfs altough THERE ARE .mdfs in this directory. But Express can find databases in the selected installation: "C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLData". Why can't Express see the directory on the D: partition???
I have query that return statuses and their totals, the data looks like: StatusCode Total---------- ---------A 100PS 50SI1 9SI2 8etc... The query returns over 30 totals, but I only want the top 9 totals plus others (the rest of the totals combined) . How do I go about this query? StatusCode Total---------- ---------A 100PS 50SI1 19SI2 18SI3 9SI4 8PS1 6PS2 6PS3 6Others 99 Also, have it work for queries that have 9 or less totals?