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
  • 0 Votes
    2 Posts
    0 Views
    D
    I think you are on the right track. Create 2 queries but use a union statement which will combine the result sets into one. Good luck. :thumbsup:
  • 0 Votes
    2 Posts
    0 Views
    Z
    I do not read technical books anymore because information is much easier to find online now. I know some people still read books and it does have its place but I would suggest you google for some examples. Often when I google how to do something in sql this blog is in the result set. http://blog.sqlauthority.com/[^] It is very well written. I highly recommend going through it. There are only 10 types of people in the world, those who understand binary and those who don't.
  • Convert row to columns in SQL View or Procedure

    database help question
    2
    0 Votes
    2 Posts
    0 Views
    M
    This article [^]might help you! You are looking at a PIVOT table. Never underestimate the power of human stupidity RAH
  • 0 Votes
    5 Posts
    0 Views
    J
    I was thinking the same thing to keep it simple OK, I'm going with that idea. Thanks!
  • Can predicates in the WHERE clause affect the type of join

    database question
    8
    0 Votes
    8 Posts
    0 Views
    U
    try it: select * from scheme.podetm d left join scheme.stockm s on s.warehouse+s.product = d.warehouse+d.product where d.qty_received >0 and d.inv_value_posted =0 and (s.analysis_a not in ('LNG','INFANREUST') or s.analysis_a is null)
  • new Apple Pay mobile wallet

    ios announcement mobile visual-studio com
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Max throughput Microsoft SQL Server?

    database sql-server sysadmin question
    11
    0 Votes
    11 Posts
    0 Views
    J
    devvvy wrote: yes many false claims, #bigclaims everywhere Given the site I suspect it is rather likely that the throughput was valid. http://highscalability.com/[^]
  • String or binary data would be truncated.

    database sql-server sysadmin question
    5
    0 Votes
    5 Posts
    0 Views
    V
    Thank you
  • The High Cost of Not Finding Information

    com help
    2
    0 Votes
    2 Posts
    0 Views
    L
    I didn't downvote you, but can see how this is close to spam. It's not a question, and that's what this forum is for. I wouldn't call it news either. I do believe there's a way to "import" a blog as "technical articles". Your writings would then have a mirror-copy in the CodeProject formatting. ..but to summarize; the problem is simply called ignorance, and that whilst all required knowledge is available for FREE. A search-engine will let you locate a text, but that's it. It doesn't show the average hours worked or the peak hours. As for structure and being incomplete, there's this method we call "normalization" to prevent that. It is an OLD method. Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]
  • 0 Votes
    3 Posts
    0 Views
    G
    Thanks - yes I was looking at this on Friday. I discovered it was a user who was running a report that kept falling over and they kept restarting it. The software is a 3rd party piece of software and it looks like when users select data the results are written to some sort of temporary table within the database. “That which can be asserted without evidence, can be dismissed without evidence.” ― Christopher Hitchens
  • Need Suggestion for Replacement DB

    csharp database sql-server wpf sysadmin
    13
    0 Votes
    13 Posts
    0 Views
    J
    At least at one time Microsoft allowed SQL Server to be used for free for smaller businesses. Figuring that out can be difficult but might be worth it. The normal goto for free alternatives is MySQL but you should look at the license for that, but an alternative which might be even better now is one that started as a fork of MySQL which is MariaDB. Those however are 'servers' and an embedded database might serve your application better. But you might want to make sure that your application will never have a need to have multiple clients and one server.
  • Dyanmic columns and PIVOT?

    database graphics help tutorial question
    7
    0 Votes
    7 Posts
    0 Views
    T
    Thank you.. yes, that worked... like I said, I used to use it, but forgot how.
  • Protect my sql server database

    database question sql-server sysadmin help
    12
    0 Votes
    12 Posts
    0 Views
    W
    If I understood your question correctly, you're worried about several, different things. As Mycroft said, the topic is way too large to discuss extensively in a post. However, few things I'd like to point out: Use proper security definitions on the server file system. No-one but admins should be let to operate with the files. Sql Server users don't need access to files See: http://msdn.microsoft.com/en-us/magazine/cc982153.aspx[^] Use either Sql Server or Windows authenticated logins along with proper database roles to limit the statements See: http://msdn.microsoft.com/en-us/library/ms189121.aspx[^] and http://msdn.microsoft.com/en-us/library/ms187965.aspx[^] Use different logins for admins If needed, encrypt the files See: http://msdn.microsoft.com/en-us/library/bb934049.aspx[^]
  • MS Server - Lock a record

    database question csharp sql-server
    6
    0 Votes
    6 Posts
    2 Views
    W
    If I understood your question correctly, you're wondering if session 1 can read the data that session 2 is locking. If this is the concern then the answer in many cases is no. Consider the following scenario: Session 1 Session 2 Select record A, field named SomeValue is 1 Select record A, field named SomeValue is 1 Begin transaction Update record A, field named SomeValue is set to 2, an eXclusive lock is taken Select record A, record is locked, session 2 waits Some other modifications Session 2 still waits Commit the transaction, lock is freed Session 2 now gets the answer, field named SomeValue is 2 (the value session 1 updated) Now the actual sequence varies depending if auto-commit is on and so on. Also you should know that if row versioning is in effect, then the behaviour is far different. For more information, read Data versioning in SQL Server using row versions[^]
  • XML select

    xml help
    2
    0 Votes
    2 Posts
    0 Views
    Kornfeld Eliyahu PeterK
    I do not understand what do you mean by (@GroupID), but you should write it like this: Ppl.GroupID.value('.', 'VARCHAR(6)') AS 'GroupID' I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
  • How to select rows from table using Name field in sql

    tutorial database
    3
    0 Votes
    3 Posts
    0 Views
    L
    Then you need some selection criteria in your database table that can be used to identify such records.
  • 0 Votes
    7 Posts
    0 Views
    D
    ∏{order#} (∑{datediff(ODate,Today)>14} (REN o(ORDER) θ{o.order#=ons.order#} REN ons( ∏ {oredr#} (ORDER) - ∏ {oredr#} (SHIPMENT)))) 2) ∏{CName} (REN c(CUSTOMER) θ{c.Cust#=onp.Cust#} REN onp( ∏ {Cust#} (CUSTOMER) - ∏ {Cust#} (ORDER))) Operators used: ∑ is SELECT ∏ is PROJECT θ is THETA JOIN - is SET DIFFERENCE REN is RENAME {} is for enclosing expressions
  • how to select last row on second CTE

    tutorial
    5
    0 Votes
    5 Posts
    0 Views
    J
    "I'm sorry, Eddy. I'm afraid I can't do that." Wrong is evil and must be defeated. - Jeff Ello[^]
  • Database design tool ?

    database design question
    8
    0 Votes
    8 Posts
    0 Views
    D
    No#1 Option: ERwin Community Edition No#2 Option: Toad Data Modeler freeware edition No#3 Option: Oracle SQL Developer Data Modeler. In [free] world, nothing else come closer to this.
  • 0 Votes
    6 Posts
    0 Views
    D
    Dilkonika, This is a typical supertype-subtype situation. I would consider ITEM as a supertype and ARTCLE and SERVICE as subtypes. Common attributes of ARTICLE and SERVICE should go to ITEM and there should be identifying relationship from ARTICLE and SERVICE to ITEM. I dont know how to attach an ER Diagram hence pasting a DDL for the schema. CREATE TABLE [ITEM] ( [item_id] char(18) NOT NULL PRIMARY KEY, [name] char(18) NULL ) go CREATE TABLE [SERVICE] ( [item_id] char(18) NOT NULL PRIMARY KEY, [nr] char(18) NULL , [value] char(18) NULL ) go CREATE TABLE [ARTICLE] ( [item_id] char(18) NOT NULL PRIMARY KEY, [category] char(18) NULL ) go CREATE TABLE [SELL_ITEM] ( [id] char(18) NOT NULL PRIMARY KEY, [quantity] char(18) NULL , [price] char(18) NULL , [value] char(18) NULL , [item_id] char(18) NULL ) go ALTER TABLE [SERVICE] ADD CONSTRAINT [R_2] FOREIGN KEY ([item_id]) REFERENCES [ITEM]([item_id]) go ALTER TABLE [SELL_ITEM] ADD CONSTRAINT [R_3] FOREIGN KEY ([item_id]) REFERENCES [ITEM]([item_id]) go ALTER TABLE [ARTICLE] ADD CONSTRAINT [R_1] FOREIGN KEY ([item_id]) REFERENCES [ITEM]([item_id]) go