Skip to content

Database

Discussions on database access, SQL, and ADO

This category can be followed from the open social web via the handle database@forum.codeproject.com

17.1k Topics 61.8k Posts
  • query

    database help tutorial question
    3
    0 Votes
    3 Posts
    0 Views
    M
    Run profiler and see where the costs are! Never underestimate the power of human stupidity RAH
  • 0 Votes
    2 Posts
    0 Views
    C
    Well you've not given us much to go on... You might as well just google optimisation tips... Data Quality and Data Profiling software
  • problem getting data in a group

    database help tutorial question learning
    4
    0 Votes
    4 Posts
    0 Views
    C
    Take a look at http://dev.mysql.com/tech-resources/articles/hierarchical-data.html, about half-way down the page looks similar to what you're asking. Data Quality and Data Profiling software
  • 0 Votes
    3 Posts
    0 Views
    M
    I assume that CutID is the FK to the tables, just wondering why it is not the primary on one of the table? Totally irrelevant to your problem. I would first put in place a nightly maintenance job that cleaned up the indexes. As to Eddys issue with uncommitted data, I would assume that queries are filtered and therefore this dodgy data should not be an issue except where you are specifically getting the latest information. There tends to be a small window of data that is subject to change, the last few records in the table. If you give your users a caveat that it may be dodgy I see no reason (nolock) should not be used. CAVEAT - note I have never used (nolock) so take this cautiously. Never underestimate the power of human stupidity RAH
  • Reverse of *

    database css com algorithms performance
    8
    0 Votes
    8 Posts
    1 Views
    R
    :) LinkedIn[^] | Blog[^] | Twitter[^]
  • Database Normalisation

    question database sales
    17
    0 Votes
    17 Posts
    0 Views
    E
    Yes, there's this one I found very useful: http://www.phlonx.com/resources/nf3/[^] The one I was referring to is this one: http://www.databasedesign-resource.com/entity-relationship.html[^] and download the free ebook. There is only one satisfying way to boot a computer.
  • 0 Votes
    1 Posts
    1 Views
    No one has replied
  • primary key

    question
    5
    0 Votes
    5 Posts
    0 Views
    L
    If you add a new constraint, Sql Server will test whether or not all of the records that are currently in the table pass that constraint. Adding the NOCHECK option will skip that test. You'd have to remove any double entries to recreate your primary key. I are Troll :suss:
  • Access Form - datasheet view, which OnEvent

    javascript database question
    4
    0 Votes
    4 Posts
    0 Views
    D
    Ah ha. I think I see what you are doing. How about this ... When you are building your dataset with a query, add a column where you can calculate a value you want displayed. For example: SELECT Payroll.WKNum, IIf([wkNum] Mod 2=0,"Even","Odd") AS OddEven FROM Payroll; This query displays the Payroll Week Number and a Text value of "Even or Odd" This would free the DataSheet View from having to do any logic processing on the dataset, it would just display it. If you need more complex logic, maybe you could extend this by manipulate a temporary table, then display that contents. Give it a shot. :cool:
  • Create a virtual table for form RecordSource

    question database
    6
    0 Votes
    6 Posts
    0 Views
    B
    The ExecuteReader() function of a command can receive a CommandBehavior parameter. Why not use CommandBehavior.SchemaOnly or CommandBehavior.KeyInfo? E.g. SqlCommand cmd = new SqlCommand("SELECT \* FROM MyTable"); SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.SchemaOnly);
  • Get Max Number for each department

    database tutorial question
    6
    0 Votes
    6 Posts
    0 Views
    M
    See the replies from Luc and Goutam, my answer is NOT the simplest way. Comes from applying the wrong tool for the job. Never underestimate the power of human stupidity RAH
  • vulnerability

    database question
    4
    0 Votes
    4 Posts
    0 Views
    S
    Actually i was not asking you people to teach me. i searched in net couldnt get any thing so thought u people may no any ref so that i learn. Any way thank you for the information.
  • T-SQL Address line Packing

    question database
    6
    0 Votes
    6 Posts
    0 Views
    L
    a bubble-sort approach could solve that; in pseudo-code: do { bool more=false; if (line1==empty && line2!=empty) {line1=line2; line2=empty; more=true;} if (line2==empty && line3!=empty) {line2=line3; line3=empty; more=true;} if (line3==empty && line4!=empty) {line3=line4; line4=empty; more=true;} while(more); :) Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
  • 0 Votes
    6 Posts
    0 Views
    L
    :thumbsup: Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
  • 0 Votes
    3 Posts
    0 Views
    D
    Good ideas. I seem to have found an option that works pretty good. Using OPENROWSET my import works okay as long as the table has equal to or more columns than the csv file. In answer to your question, it is possible that different rows have different number of fields. So far in the examples I've played with Openrowset allows records to be added and any missing columns are taken off from the last columns. I can live with that since I can delete the rows later if needed. Now for the few records that were possibly causing the whole import to crash, I now get the whole import and can do a search and delete rows afterwards. Sorry for the delayed response. I've just got back to my computer. Many thanks for your ideas Mycroft, I would try them next. :) Dean
  • 0 Votes
    3 Posts
    0 Views
    K
    Thanks man. Thats exactly what i was looking for.
  • Access 2007 - black hole forms

    database tools question
    6
    0 Votes
    6 Posts
    0 Views
    L
    Whehe, cool collegue! :cool: I are Troll :suss:
  • SQL Select Question

    database sql-server sysadmin help question
    4
    0 Votes
    4 Posts
    0 Views
    J
    You need to do a sub-select to get a list of the employees and the date of their most recent picture. Then you join to that on the EmployeeID (OwnerGuid) and the date. select c.BadgeName, a.Photo, c.Updated from Image a join (select OwnerGUID, MAX(PictureDate) PictureDate from Image group by OwnerGUID) b on a.OwnerGUID = b.OwnerGUID and a.PictureDate = b.PictureDate join vwEmployee c ON a.OwnerGUID = c.OwnerGUID where c.Department = 'IT'
  • sql function

    database tutorial question
    5
    0 Votes
    5 Posts
    4 Views
    J
    It looks like you're trying to get the hour:minute:second difference between two datetime values. The simplest way to do that is subtract them, then convert that value to char and apply the appropriate formatting. declare @t1 datetime, @t2 datetime select @t1 = GETDATE() --Select @t2 = @t1 + 1:02:03 (hh:mm:ss) select @t2 = DATEADD(hour, 1, dateadd(minute, 2, dateadd(second, 3, @t1))) select convert(varchar, @t2-@t1, 108) You can find other formatting options here[^]
  • sql procedure

    database
    5
    0 Votes
    5 Posts
    0 Views
    J
    It looks like you just forgot to wrap EM_FirstName in an isnull. Otherwise I don't see why that wouldn't work with MSSQL.