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
  • SQL Table Grouping

    database help
    19
    0 Votes
    19 Posts
    3 Views
    M
    Not really knowing the structure of your keys - something like this should work. SELECT s.PI, s.JobID, s.FormID, s.ShiftID, s.StartEvent, s.SW, s.SG, e.EndEvent, e.EG, e.EW FROM [BaseTable] s INNER JOIN [BaseTable] e ON (s.PI = e.PI AND s.JobId = e.JobId AND s.FormId = e.FormId AND s.ShiftId = e.ShiftId AND e.EndEvent = (SELECT MAX(EndEvent) FROM [BaseTable] WHERE s.PI = PI AND s.JobId = JobId AND s.FormId = FormId AND s.ShiftId = ShiftId)) WHERE s.StartEvent = (SELECT MIN(StartEvent) FROM [BaseTable] WHERE s.PI = PI AND s.JobId = JobId AND s.FormId = FormId AND s.ShiftId = ShiftId)
  • sql server 2008 r2

    help database sql-server sysadmin
    5
    0 Votes
    5 Posts
    0 Views
    N
    Do it using SQL Script (like alter etc...) instead of using SSMS Niladri Biswas (Code Project MVP 2012)
  • 0 Votes
    6 Posts
    0 Views
    N
    All Version of Sql server Select City, AVG(Salary) AS Salary FROM @t Group By City Order By City DESC This can also be done by treating AVG function as Analytical function which is available since SQL Server 2005 Select City,Salary From ( Select Rn = Row_Number() Over(PARTITION BY City Order By (Select 1)) ,City ,AVG(Salary) OVER(PARTITION BY City) AS Salary From @t) X Where X.Rn = 1 Order By City DESC The answer for both the cases City Salary Seattle 20000 Redmond 30000 Niladri Biswas (Code Project MVP 2012)
  • Help with Decimal Roundings

    csharp help asp-net com
    4
    0 Votes
    4 Posts
    0 Views
    N
    Declare @X float = 0.833333333333333 SELECT ROUND(@X*100,0) Niladri Biswas (Code Project MVP 2012)
  • ssis database reocords to execel sheet

    database sql-server docker tutorial
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • 0 Votes
    15 Posts
    0 Views
    L
    qureshiaquib wrote: what is meysam post? Not a what, but a "whom". I was referring to a good answer to your question that has been sent to you by someone with that name[^]. Did you succeed in adding a reference to the project yet? Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • 0 Votes
    7 Posts
    0 Views
    P
    Sounds like something is goofy with the drivers on that specific machine. Good luck and if anything comes to mind, I'll let you know. "Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
  • C# SQL express Login

    csharp database help visual-studio linq
    17
    0 Votes
    17 Posts
    0 Views
    S
    can i get the corrected code plz i am working on the same project
  • 0 Votes
    2 Posts
    0 Views
    L
    SubiyaPalanisamy wrote: Intended Audience and reading suggestions  MetTube’s IT and user team to review the current requirements  Base document for MetTube to address their future requirements That did not include CodeProject; this looks like a confidential document. I suggest you edit it a bit, and delete everything that's not part of the question. You can get help with any specific question if you're stuck. SubiyaPalanisamy wrote: This my first project using asp.net2012 and sqlserver 2008... If you have had training, then I suggest you start with the use-cases and the functional design. If this is really the first project, then this might be a bit too complex to start with. By when should this be finished? Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • Symantec Q&A File Conversion

    tools help question
    6
    0 Votes
    6 Posts
    1 Views
    S
    Thanks for the good suggestion - after I read it I tried both formats, but to no avail. Thanks again.
  • Database status check and report

    csharp database oracle help
    5
    0 Votes
    5 Posts
    0 Views
    L
    Thanx a lot.I even add more functionalities/Methods :-D
  • Cumulative addition among views.

    database hosting help tutorial lounge
    2
    0 Votes
    2 Posts
    0 Views
    M
    I think you are using the wrong tool for the job. You have a bunch of views (1 for each month) that you are trying to force into a larger structure (aggregated monthly values) why not ignore the monthly views and go directly to the underlying table/view to service your requirement. SELECT MthField, SUM(field1), COUNT(Field2) FROM TransactionView WHERE filter = .... GROUP BY MthField OR If you are using SSRS (you mention report) then use SSRS aggregating functions to get you totals. Never underestimate the power of human stupidity RAH
  • 0 Votes
    3 Posts
    0 Views
    L
    Member 4006546 wrote: How to convert Physical XML files into Sqlserver Tables? ..documentation[^]. Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • How to store a standard selection?

    question csharp com tutorial learning
    6
    0 Votes
    6 Posts
    0 Views
    R
    The default is set to true, the rest to false. "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me
  • Username/password protected database

    database sql-server sysadmin
    4
    0 Votes
    4 Posts
    0 Views
    L
    You can't "lock" the database with a password. The only way to "protect" your database-model is to keep it on your own server and to provide a web-service to access it. The owner of the server will be considered the owner of the data, and you can't lock the owner out. Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • SQL Query - write all in one query

    database agentic-ai
    20
    0 Votes
    20 Posts
    0 Views
    L
    You're welcome :) Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • 0 Votes
    6 Posts
    0 Views
    D
    I agree with the performance observed. A query which returns 300K rows is typically not a online transaction where a user is waiting for the results to display, so what does it matter if you shave a few seconds off the execution time? (rhetorical question here) Also noted is that there is no "where clause", so each time this query is run it will take longer and longer. Right? More and more data will be created each day... If this is an online transaction, then maybe a strategy where summary tables are populated as transactions are being generated might be something to investigate.
  • 0 Votes
    10 Posts
    0 Views
    L
    asimptota777 wrote: I must admit that your signature really suits you... Thank you - it was hard to earn that title :-D You could repost the question with a link to this thread. State in the new post that this wasn't helpful, and someone might come up with something better. asimptota777 wrote: Dude, I know what full text search is and how it functions. I just don't know how to implement the functionality I've mentioned. I did not look at the requirements; technically, you want to retrieve documents based on a searchterm. You get a list of documents that contain that term. You can retrieve the document. What's keeping you from doing a substring on that document and parse out the line? You can fetch the index where the word is in the document, then you work your way back to the first word with a capital letter, and forward to the first interpunction. Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • Insert Function Inserts Only Parameternames

    database help
    6
    0 Votes
    6 Posts
    0 Views
    L
    mark merrens wrote: Really? How bizarre. VALUE is a reserved keyword; it would be like having a variable called "SELECT". Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]
  • Records on the basis of two different tables.

    database sql-server sysadmin
    3
    0 Votes
    3 Posts
    0 Views
    S
    Eddy Vluggen wrote: To prove that point, I'll be fetching some coffee. I suggest you post your code in PRE tags, including one or two queries that you already tried. They needn't be good, we're not going to whine about it; it's just a good idea to have "proof" you tried something. +5 purely for that! Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch