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
  • Relation Theory

    question database design security tutorial
    3
    0 Votes
    3 Posts
    0 Views
    L
    In your example, a Credit Card can be owned by one and only one person at a time, therefore a bridge table would not be required. A bridge table is required only in a many-to-many relationship.
  • Dynamic column based on row

    css database sql-server com sysadmin
    2
    0 Votes
    2 Posts
    0 Views
    D
    You need to pivot[^] the "Additions" table, before joining it to the "MainTable" on emp_code.
  • MySql Foreign key

    database mysql sql-server sysadmin question
    2
    0 Votes
    2 Posts
    0 Views
    J
    There is nothing it TSQL (Microsoft SQL Server "Transactional SQL") that is going to automatically insert foreign key values. You might have used some tool that created TSQL for you, but then it generated TSQL which explicitly inserted the key value.
  • Using a variable table [modified]

    sharepoint database help question announcement
    2
    0 Votes
    2 Posts
    0 Views
    J
    If you want to vary the table name dynamically then you must use dynamic SQL. There is no alternative. Either sp_executesql or 'execute' can be used. Are you sure it needs to be dynamic though?
  • Where is my table created...

    question database sql-server sysadmin tools
    8
    0 Votes
    8 Posts
    0 Views
    J
    Jun Du wrote: create a table on the master databse: You need to learn to create your own database and then tables go in that. And once you do delete everything that you created in 'master'.
  • Duplicate a record

    help tutorial
    2
    0 Votes
    2 Posts
    0 Views
    S
    Can't tell exactly what's wrong but you seem to have too many joins. That cross join... hmmm... I am nos sure what you want to do. Personally, I would use a union operator to duplicate records. SELECT a.col1, a.col2,... 0 As Flag FROM myTable a WHERE ... UNION SELECT b.col1,b.col2,... 1 as Flag FROM myTable b WHERE ....
  • database function

    csharp database
    4
    0 Votes
    4 Posts
    0 Views
    S
    I know.... personally I would have preferred a stored procedure.
  • A question about design Relational Model

    help database design tutorial question
    24
    0 Votes
    24 Posts
    0 Views
    S
    Suppose I have a calculated field for age computed from dob and the current date. If this field is not updated and you query someone's age, it will return incorrect results. For example, if the query returns someone's [current] age as 64 when it should have been 65, the result would be incorrect.
  • showing column data as header

    database com help career
    6
    0 Votes
    6 Posts
    0 Views
    M
    Check the following query... SELECT T1.empcode,T1.[basic Salary],B.Bonus,T.Transport FROM Table1 T1 INNER JOIN (SELECT Amount As Bonuus, empcode FROM Table2 WHERE Additions = 'Bonus') B ON B.empcode = T1.empcode INNER JOIN (SELECT Amount AS Transport, empcode FROM Table2 WHERE Additions = 'Transport') T ON T.empcode = T1.empcode Adjust the inner join to left join if required... Thanks
  • How do I join for tables together?

    question database
    3
    0 Votes
    3 Posts
    0 Views
    S
    Your code is using an implicit equijoin and a cartesianjoin. WHERE RF.REPAIR_ORD = RH.REPAIR_ORD and Rp.REPAIR_ORD = cg.REPAIR_ORD For simplicity, let me assume the actual table names are RF, RH, RP and CG. RH and RH are joined and RP and CG are joined but RF is not joined to RP or CG; and also RH is not joined to RP and CG. So the end result is a cartesian product of two equijoins (RF-RH X RP-CG). I would suggest using an explicit join. From your code, I assume that REPAIR_ORD is common to all the tables. So my code would look like SELECT ..... FROM RF INNER JOIN RH ON RF.REPAIR_ORD=RH.REPAIR_ORD INNER JOIN RP ON RH.REPAIR_ORD=RP.REPAIR_ORD INNER JOIN CG ON RP.REPAIR_ORD=CG.REPAIRD_ORD WHERE .... I am using inner joins but depending on what you need, you may find left joins or right joins more suitable.
  • Set variable values from queried data

    sales help
    4
    0 Votes
    4 Posts
    0 Views
    S
    I haven't tested this but try it . SELECT TOP 1 @dtLatestDate=dtDateTime, @fltLatestPrice =fltPrice FROM Customers ORDER BY dtDateTime DESC SELECT TOP 1 @dtEarliestDate =dtDateTime, @fltEarliestPrice=fltPrice FROM Customers ORDER BY dtDateTime ASC
  • How do I to mass update date and time?

    database help question tutorial announcement
    5
    0 Votes
    5 Posts
    4 Views
    B
    No problem :) I Love T-SQL "Don't torture yourself,let the life to do it for you." If my post helps you kindly save my time by voting my post. www.cacttus.com
  • Execution Plan Caching and Reuse

    database com regex tutorial
    3
    0 Votes
    3 Posts
    0 Views
    P
    :: PIEBALD closes his blinds :: Actually, I've already switched to tequila.
  • possible LINQTOSQL active connections

    csharp database visual-studio question
    3
    0 Votes
    3 Posts
    0 Views
    J
    wjbjnr wrote: I just wanted to know how many different connections at a same time can be made from different computers? 64k. Or some number pretty close to that. There are gotchas for that. 1. They must exist at the same time. 2. The number can be smaller, quite a bit, if the clients are rapidly opening and closing connections. 3. The number can be smaller, specifically 5000, if you have not explicitly updated the MS Windows registry of the server box. This is the maximum and is impacted by 2 above as well. None of that has to do with the database and certainly not tables. It has to do with the IP address. So if you have a computer with more than one real IP Address then each is subject to the same restrictions. See the following http://msdn.microsoft.com/en-us/library/aa560610.aspx[^] Be very careful if you start messing with those values.
  • Unable to load client print control

    database sysadmin tutorial announcement
    8
    0 Votes
    8 Posts
    0 Views
    S
    I have also tried the various work arounds, non of which have worked after a reboot. I've instructed my users to export the data to PDF and print from there (and disabled the print control). Major Pain... Common sense is admitting there is cause and effect and that you can exert some control over what you understand.
  • Update All records

    csharp database tutorial question
    5
    0 Votes
    5 Posts
    0 Views
    I
    Thanks this is work for me!
  • SQL Query for Update Column

    database help sql-server sysadmin announcement
    5
    0 Votes
    5 Posts
    0 Views
    M
    Hello, I tried with above query.But it extracting 10 Digits.I dont know why.I have some datas in Field4 like this "74_125352" actually i need 125352. modified on Sunday, May 8, 2011 1:46 AM
  • Performance in Microsoft SQL Server

    database sql-server sysadmin performance tutorial
    10
    0 Votes
    10 Posts
    0 Views
    P
    i think little bit issue will arise. If you instantiate an object for ten times or create ten object or some method of an object (like,- Open() and Close()) performance can be a issue . mostly its a bad programming practice.
  • Need some Oracle help if possible [modified]

    help database oracle json announcement
    10
    0 Votes
    10 Posts
    0 Views
    J
    I wasn't being sarcastic. To help with diagnosing a code question one needs to post the code that is the source of the problem.
  • Need a little help in working with CLOB data, please [modified]

    help question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied