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
  • Migration error from SQL 2014 to SQL 2012

    database help sql-server sysadmin sales
    9
    0 Votes
    9 Posts
    0 Views
    K
    Thank you Kornfeld Eliyahu Peter. KV
  • 0 Votes
    3 Posts
    0 Views
    L
    Jassim Rahma wrote: I would like to ask what's the best field type to use for such requirment? What's the reason you're asking? In MySQL[^], TINYINT(1) = BOOLEAN = BIT A value of zero is considered false. Nonzero values are considered true. Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
  • Not in for two columns with Inner join

    database sql-server sysadmin xml tutorial
    2
    0 Votes
    2 Posts
    0 Views
    M
    Try this where clause. Where not exists (Select * from ProdCost where Year = #Temp.Year and ProdID = #Temp.ProdID) Never underestimate the power of human stupidity RAH
  • how to join all three query results to one in mysql

    database mysql regex tutorial
    3
    0 Votes
    3 Posts
    0 Views
    S
    if i use UNION i will get one column result. I should get 3 column but without null values. How to achieve this
  • 0 Votes
    17 Posts
    0 Views
    V
    so basically you have this? DEED_NR START_SHARE END_SHARE 1             1                     50 2             1                     25 3             1                     75 If you need get them out the result should be 1 - 150. If that´s the case you could use the SUM function: Select sum(END_SHARE) from DEEDS if your START_SHARE = END_SHARE+1 (1-49, 50-74, 75-154 eg) of the previous record you just need to select that last record of the deed containing the shares. Select END_SHARE from DEEDS HAVING DEED_NR = max(DEED_NR) --(not sure if a having works without a group by, but there are other constructs doing similar things.) hope this gives you an idea. V. (MQOTD rules and previous solutions)
  • Execute Oracle Procedure from VB.NET ORA-009000 error

    csharp database oracle help
    17
    0 Votes
    17 Posts
    17 Views
    G
    Yes ,for some, the forum works one way - it's there just to get answers to your questions and not to contribute to the wider knowledge of the community. “That which can be asserted without evidence, can be dismissed without evidence.” ― Christopher Hitchens
  • 0 Votes
    2 Posts
    0 Views
    Kornfeld Eliyahu PeterK
    When you create a complex SQL query with a large number of joins you may get into the problem of same column names in different tables. To assign a name of your choice to any of the returned columns you may use the format of table.field as my_field_name It is irrelevant from where the tables are as long as you can link to those databases - do you have problem there? I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
  • 0 Votes
    8 Posts
    0 Views
    M
    I would build a dedicated admin delete view where the admin can see a list of items flagged for delete, possibly a treeview if they are deep enough and allow the admin to confirm delete. Chasing down the dependency tree will be a PITA unless you know the structure intimately, the diagram should help. It does seem a lot of work to get rid of junk when you already filter it out with a flag, I presume your flag already does the cascade thing (unless you cheated and only did the top levels). Why not change the flag to a datetime and delete anything flagged older than n months/years in a purge function. Never underestimate the power of human stupidity RAH
  • 0 Votes
    3 Posts
    1 Views
    S
    Thanks for letting me know. Silly of me to have posted such a question on db forum.
  • SQL statement

    database question
    8
    0 Votes
    8 Posts
    0 Views
    T
    You try to do this by the following code: select max(Actuators.Date) from table1 where Actuators.Date<(select max(Actuaors.Date) from t1); i hope it can help you.
  • How many types of lock exist in Sql server

    database sql-server sysadmin
    3
    0 Votes
    3 Posts
    0 Views
    C
    Since you did not provide which SQL Server the answer is several. Query BOL and you will find them. You will also need to know the type of resource that is being locked. DATABASE, FILE, OBJECT, PAGE, KEY, EXTENT, RID, APPLICATION, METADATA, HOBT, ALLOCATION_UNIT
  • INNER JOIN

    database help tutorial
    3
    0 Votes
    3 Posts
    0 Views
    A
    Hi, I don't understand what exactly you want to do, but there are two ways to insert data: 1. Insert values. INSERT INTO Table1 (Column1, Column2) VALUES (@Value1, @Value2); 2. Insert from table/tables. INSERT INTO Table1 (Column1, Column2) SELECT Column1, Column2 FROM Table2 WHERE Column1 = @Parameter; or something like INSERT INTO Table1 (Column1, Column2) SELECT t2.Column1, t3.Column2 FROM Table2 AS t2 INNER JOIN Table3 AS t3 ON t2.ColumnID = t3.ColumnID WHERE t2.Column1 = @Parameter; Best regards, Andrius Leonavicius
  • converter

    mysql help question
    2
    0 Votes
    2 Posts
    0 Views
    M
    Red-Gate SQL Compare works with SQL Server not sure what your DB is but it may be compatible. Never underestimate the power of human stupidity RAH
  • why looping is not starting from my start date?

    help sharepoint database mysql sales
    6
    0 Votes
    6 Posts
    1 Views
    J
    Which is what I was trying to tell him. Play the SQL parser, read the date in the table. 9 times out of ten when you compare dates there is something with the full timestamp in the field that is messed up. Or maybe the field doesn't have a full date saved which causes comparisons to fail when you think they won't. For example 22/04/2014 10:00:00 is greater than 22/04/2014 00:01:00 but depending on the way SQL comparisons work (I'm reaching into ancient history) it is not greater than 22/04/2014 because the parser interprets 22/04/2014 into 22/04/2014 12:00:00 sometimes you have to use tochar function to compare dates
  • 0 Votes
    4 Posts
    0 Views
    J
    Oh bugger. I forgot to check the version. Wrong is evil and must be defeated. - Jeff Ello[^]
  • SQL Query

    database help question
    4
    0 Votes
    4 Posts
    0 Views
    Richard DeemingR
    Try something like: SELECT TOP 1 House, DateT, TempIn, tempOut, Humidity, TMushroomHouse.Name As MushroomHouseName FROM Environmnets INNER JOIN TDevice ON Environmnets.Deviceid = TDevice.id INNER JOIN TMushroomHouse ON TDevice.MushroomHouseId = TMushroomHouse.id WHERE TMushroomHouse.Name = @MushroomHouseName ORDER BY Environmnets.DateT DESC This adds the Name column from the TMushroomHouse table as a new result column called MushroomHouseName. You can then read it from your code and put it in a textbox: while (dr.Read()) { ... MushroomHouseTextBox.Text = dr["MushroomHouseName"].ToString(); } "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
  • 0 Votes
    2 Posts
    0 Views
    T
    AshwiniSH wrote: Can anyone please provide me the connection string? http://www.connectionstrings.com/[^] AshwiniSH wrote: 1. domain is created in my server. 2. Remote access is enabled for the sql server 3. TCP/IP port is also enabled. From link[^]: Basically, when you failed to connect to your SQL Server, the issue could be: 1) Network issue, 2) SQL Server configuration issue. 3) Firewall issue, 4) Client driver issue, 5) Application configuration issue. 6) Authentication and logon issue. Check these Steps to troubleshoot SQL connectivity issues[^] SQL Server 2005 Connectivity Issue Troubleshoot - Part I[^] Troubleshoot Connectivity Issue in SQL Server 2005 - Part II[^] Troubleshoot Connectivity Issue in SQL Server 2005 - Part III[^] AshwiniSH wrote: I am struggling for this since 3 days. :confused: Hangover? Last 3 days're holidays.
  • would you use RDLC?

    com question announcement
    5
    0 Votes
    5 Posts
    0 Views
    J
    Great.. Thanks Mycroft :) Technology News @ www.JassimRahma.com
  • Old school dbase II / clipper database, multiple left joins

    database help
    4
    0 Votes
    4 Posts
    0 Views
    J
    That Works! Thanks Jorgen SELECT c.FINVNO ,c.FCUSTNO ,c.FCOMPANY ,c.FSALESPN ,c.FSHIPVIA ,c.FORDDATE ,c.FSHIPDATE ,c.FNTAXAMT ,(SELECT a.FADDR1 FROM ARCUS01.dbf a WHERE c.FCUSTNO = a.FCUSTNO) AS FADDR1 ,(SELECT e.FEMAIL1 FROM ARCEM01.dbf e WHERE c.FCUSTNO = e.FCUSTNO) AS FEMAIL1 FROM ARINV01.dbf c WHERE c.FORDDATE=@startDate
  • Why connection is failing?!

    help csharp com sales question
    10
    0 Votes
    10 Posts
    0 Views
    L
    Jassim Rahma wrote: and by the way, I was not pointing fingers :) Lol My bad; it could have been, depending on language and intonation :) I usually take the exception-message as a starting point; Jassim Rahma wrote: "MySQL A connection attempt failed because the connected third party did not properly respond after a period of time" Plan of attack; Create a console-app, use the users' credentials, and try a minimal query (SELECT 1 or something similar) Test once with your current data provider (MySQL Connector.NET?) Copy the project, try another data provider (MySQLDotNET[^]) Try the same again, using the dba-account. If you can terminal to MySQL, then the server is there; that you said was true. That means that you can skip checking the firewall and the port on which MySQL speaks. The reason I'm asking to test with the dba's account is that he should have unrestricted access to all tables. If that one connects correctly, then you'd need to do some extra grants on your users' accounts. What does your connection-string look like? Can you post it here? (Without the login-info) Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]