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
  • peak hours query

    database mysql com help announcement
    4
    0 Votes
    4 Posts
    1 Views
    S
    Not sure if this will directly work in MySQL, but here is what I would do in SQL Server SELECT DATEPART(hh, Created_Date) [Hours] , COUNT(*) [Patients] FROM Visit GROUP BY DATEPART(hh, Created_Date) EDIT There is a format function in MySQL that will return the hour https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_date-format[^] Common sense is admitting there is cause and effect and that you can exert some control over what you understand.
  • test1

    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Problem closing patient file!

    announcement database com help
    9
    0 Votes
    9 Posts
    0 Views
    G
    Hi, Use DEFAULT Constraint.... ALTER TABLE visits MODIFY closed_date DATETIME NOT NULL DEFAULT NOW(); Check the following link MySQL ALTER Command[^]
  • SQLExpress scripted install

    database sysadmin help mobile sql-server
    2
    0 Votes
    2 Posts
    0 Views
    L
    this turned out to be an issue with the computer name and the user name being the same. Aparently as of Vista, this is an issue. I had ruled this out when I renamed the computer, uninstalled sql through add/remove programs, and ran the installer again. Grabbing at straws I just happened to notice that the folders and files don't get removed when you add/remove sql through the control panel. I removed it again, and manually deleted the Microsoft SQL SErver folder, rebooted again, and installed. This worked. If it moves, compile it
  • sql server table records to sqlite

    database question sharepoint android sql-server
    18
    0 Votes
    18 Posts
    0 Views
    J
    Realy thanks! I have installed an app android that do same as what i wanna and i have installed it and got this file that have info but cannot read that. what type of data it have .is it SQLite or something else. how can i do that same? download the data file : http://upload.ugm.ac.id/221asnaf and download app : http://upload.ugm.ac.id/561A0829-MashaghelHamrah.apk[^] thanks in advanced !
  • database

    question database
    5
    0 Votes
    5 Posts
    0 Views
    M
    1.Store data 2.Makes data available 3.Google 4.All databases are different! 5. Do your own homework. Never underestimate the power of human stupidity RAH
  • SQL weirdness when aliasing columns

    database xml performance help algorithms
    8
    0 Votes
    8 Posts
    0 Views
    M
    Good bit of research, thanks for posting the solution, that with parameter sniffing goes into my odd box of delays to hunt for! Never underestimate the power of human stupidity RAH
  • sql server 2008 query,

    database sql-server help sysadmin tutorial
    8
    0 Votes
    8 Posts
    2 Views
    G
    Hi Its simple Use COUNT Function... like as follows SELECT CAST(ISNULL(COUNT(ProdType),0) AS VARCHAR(10)) + ' '+ ProdType FROM ProdDtls GROUP BY ProdType Regards, GVPrabu
  • Database

    question database
    8
    0 Votes
    8 Posts
    0 Views
    S
    Member 9611795 wrote: I want to know the tool which can help me to insert data and retrieve it and more. SQL Server is where data is stored, ADO.NET is a set of objects for Creating, Reading, Updating and Deleting data. Common sense is admitting there is cause and effect and that you can exert some control over what you understand.
  • Help for RSA ...plzzz

    help question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    4 Posts
    0 Views
    M
    Sorry I was not very clear, I use the tool and the generated script. IF it fails (it automatically rolls back the transaction) I then use a subset of the objects, starting with the tables. I repeat this till I get a successful merge. I then save that script and get the next subset, repeating until I get all the changes across to the target database. At that point I have a set of scripts that can be run sequentially to successfully update the target database. This is a pain but it is better than hand coding which is how I used to do it! Never underestimate the power of human stupidity RAH
  • SQL Server 2012 annoyance...

    database help sql-server com sysadmin
    5
    0 Votes
    5 Posts
    1 Views
    M
    _Damian S_ wrote: any wonder I didn't think to look there!! Especially if you are not in the habit of using the bloody things. I wonder how many versions they have upgraded through, I don't recall sql auto generating triggers. Never underestimate the power of human stupidity RAH
  • Dual Primary Key?

    question
    7
    0 Votes
    7 Posts
    0 Views
    L
    Mycroft Holmes wrote: Why would you not use WharehouseID-ProductID in a concatenated field as a primary key. That's a possibility; then again, it introduces a concatenation-action, and we'd be storing redundant information. It'd also affect performance; having a large varchar-based key (as two bigints as Id's or Guids would be concatenated to a varchar) would be not-nice for your indexes. Or, in the words of my teacher; it would no longer be an atomic value. Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
  • 0 Votes
    4 Posts
    0 Views
    H
    Thanks for your responses. Error is resolved, that was more logical. I was creating Command object at class level, and adding parameters to it in remainderMailtimer_Elapsed(). This event will execute on timer interval. So when it executes first time it find one parameter and runs successfully. after 3 minutes interval it executes event for the second time and adds same parameter to it. so now command object will have two parameters and corresponding SP has one. So it was throwing error. I changed the code and created command object at event level. Thanks. By: Hemant Thaker
  • Book recommendation for learning SQL

    learning database question
    6
    0 Votes
    6 Posts
    1 Views
    G
    Hi, Check the following Books. -- Book 1 Book Name : Beginning SQL Server 2008 for Developers From Novice to Professional Jul 2008 Authors : Louis Davidson, With Kevin Kline, Scott Klein, and Kurt Windisch Publisher : APress -- Book 2 Book Name : Pro-T-SQL-2008-Programmers-Guide-Experts-Voice-in-SQL-Server Author : Michael Coles Publisher : APress Regards, GVPrabu
  • 0 Votes
    24 Posts
    4 Views
    G
    Hi, I think You are asking about "IDENTITY" Property in SQL Server right. If you will use IDENTITY while creating table, It will Increment Automatically based on your Starting value and Increment. For Example, CREATE TABLE #T1 (ID INT NOT NULL IDENTITY(1,1), Name VARCHAR(12)) INSERT INTO #T1(Name) VALUES('A') SELECT * FROM #T1 BEGIN TRAN T1 INSERT INTO #T1(Name) VALUES('B') ROLLBACK TRAN T1 INSERT INTO #T1(Name) VALUES('C') SELECT * FROM #T1 So Once Identity values is Incremented, In case If Transaction Roll backed also you will get next value only. Regards, GVPrabu.
  • What is Ado.net

    csharp database help design tutorial
    5
    0 Votes
    5 Posts
    0 Views
    T
    This is really a great tip for the beginners. i thank you from all the Beginners those who need a Elaborated definition to understand the concepts..
  • update values in a table in single query

    database help question announcement
    7
    0 Votes
    7 Posts
    0 Views
    G
    Hi Naina, Check the Script, U can use CASE Statement in UPDATE. CREATE TABLE #EmpDtls(ID INT, EmpGender CHAR(1)) INSERT INTO #EmpDtls (ID, EmpGender) VALUES (1,'M'),(2,'F'),(3,'M') SELECT ID, EmpGender FROM #EmpDtls -- Update Statement UPDATE #EmpDtls SET EmpGender = (CASE WHEN EmpGender='M' THEN 'F' WHEN EmpGender='F' THEN 'M' END) SELECT ID, EmpGender FROM #EmpDtls Regards, GVPrabu
  • SQL 2008 Truncate vs Delete

    database question visual-studio
    8
    0 Votes
    8 Posts
    0 Views
    G
    Hi, -- DELETE, TRUNCATE and DROP Statements DELETE /* The DELETE command is used to remove rows from a table. A WHERE clause can be used to only remove some rows. If no WHERE condition is specified, all rows will be removed. After performing a DELETE operation you need to COMMIT or ROLLBACK the transaction to make the change permanent or to undo it. Note that this operation will cause all DELETE triggers on the table to fire. */ TRUNCATE /* TRUNCATE removes all rows from a table. The operation cannot be rolled back and no triggers will be fired. As such, TRUCATE is faster and doesn't use as much undo space as a DELETE. */ DROP /* The DROP command removes a table from the database. All the tables' rows, indexes and privileges will also be removed. No DML triggers will be fired. The operation cannot be rolled back. */ --Difference between TRUNCATE and DELETE commands /* 1) TRUNCATE is a DDL command whereas DELETE is a DML command. 2) TRUNCATE is much faster than DELETE. Reason:When you type DELETE.all the data get copied into the Rollback Tablespace first.then delete operation get performed.Thatswhy when you type ROLLBACK after deleting a table ,you can get back the data(The system get it for you from the Rollback Tablespace).All this process take time.But when you type TRUNCATE,it removes data directly without copying it into the Rollback Tablespace. Thatswhy TRUNCATE is faster.Once you Truncate you cann't get back the data. 3) You cann't rollback in TRUNCATE but in DELETE you can rollback. TRUNCATE removes the record permanently. 4) In case of TRUNCATE ,Trigger doesn't get fired. But in DML commands like DELETE .Trigger get fired. 5) You cann't use conditions(WHERE clause) in TRUNCATE. But in DELETE you can write conditions using WHERE clause */ Regards, GVPrabu
  • jdbc

    help
    3
    0 Votes
    3 Posts
    0 Views
    M
    If you are looking to get the code written then try Elance or one of the other code writing sites. CodeProject is for people who want to write their own code and need a little help learning. Never underestimate the power of human stupidity RAH