Search Results

Search found 7127 results on 286 pages for 'calculated columns'.

Page 146/286 | < Previous Page | 142 143 144 145 146 147 148 149 150 151 152 153  | Next Page >

  • Is it OK to manage associations manually?

    - by sosborn
    Here are the relevant models: User Product Order A User can sell or buy products An order has a buyer, a seller and one product I know that I can do this with a HABTM relationship between orders and user, but is seems to me like it would be simpler to put in the Order table the following columns: :seller_id :buyer_id and manage those relationships manually as orders are only created once and never edited. However, this doesn't seem very Rails-like and I am wondering if I am missing something conceptually at the HABTM relationship.

    Read the article

  • How would you structure your entity model for storing arbitrary key/value data with different data t

    - by Nathan Ridley
    I keep coming across scenarios where it will be useful to store a set of arbitrary data in a table using a per-row key/value model, rather than a rigid column/field model. The problem is, I want to store the values with their correct data type rather than converting everything to a string. This means I have to choose either a single table with multiple nullable columns, one for each data type, or a set of value tables, one for each data type. I'm also unsure as to whether I should use full third normal form and separate the keys into a separate table, referencing them via a foreign key from the value table(s), or if it would be better to keep things simple and store the string keys in the value table(s) and accept the duplication of strings. Old/bad: This solution makes adding additional values a pain in a fluid environment because the table needs to be modified regularly. MyTable ============================ ID Key1 Key2 Key3 int int string date ---------------------------- 1 Value1 Value2 Value3 2 Value4 Value5 Value6 Single Table Solution This solution allows simplicity via a single table. The querying code still needs to check for nulls to determine which data type the field is storing. A check constraint is probably also required to ensure only one of the value fields contains non-nulll data. DataValues ============================================================= ID RecordID Key IntValue StringValue DateValue int int string int string date ------------------------------------------------------------- 1 1 Key1 Value1 NULL NULL 2 1 Key2 NULL Value2 NULL 3 1 Key3 NULL NULL Value3 4 2 Key1 Value4 NULL NULL 5 2 Key2 NULL Value5 NULL 6 2 Key3 NULL NULL Value6 Multiple-Table Solution This solution allows for more concise purposing of each table, though the code needs to know the data type in advance as it needs to query a different table for each data type. Indexing is probably simpler and more efficient because there are less columns that need indexing. IntegerValues =============================== ID RecordID Key Value int int string int ------------------------------- 1 1 Key1 Value1 2 2 Key1 Value4 StringValues =============================== ID RecordID Key Value int int string string ------------------------------- 1 1 Key2 Value2 2 2 Key2 Value5 DateValues =============================== ID RecordID Key Value int int string date ------------------------------- 1 1 Key3 Value3 2 2 Key3 Value6 How do you approach this problem? Which solution is better? Also, should the key column be separated into a separate table and referenced via a foreign key or be should it be kept in the value table and bulk updated if for some reason the key name changes?

    Read the article

  • How many indexes will actually get used?

    - by Ender
    I'm writing a page that does very simple search queries, resulting in something like: SELECT * FROM my_table WHERE A in (a1, a2, a3) AND B in (b1, b2) AND C in (c1, c2, c3, c4) AND And so on for a variable number of columns, usually ~5. If I create a separate index for each column (one for A, one for B, one for C, not (A,B,C)), will all of them be used in the above query?

    Read the article

  • How to convert a DataTable to a string in C#?

    - by Mark Allison
    Hi there, I'm using Visual Studio 2005 and have a DataTable with two columns and some rows that I want to output to the console. I hoped there would be something like: DataTable results = MyMethod.GetResults(); Console.WriteLine (results.ToString()); What's the best way (i.e. least amount of coding from me) to convert a simple DataTable to a string? Thanks, Mark.

    Read the article

  • Multi table Triggers SQL Server noob

    - by Chin
    I have a load of tables all with the same 2 datetime columns (lastModDate, dateAdded). I am wondering if I can set up global Insert Update trigger for these tables to set the datetime values. Or if not, what approaches are there? Any pointers much appreciated

    Read the article

  • 398 row datalist slowing down modal open????

    - by Jreeter
    Hey guys I got a weird issue.. I have a datalist that's only loaded on pageload it contains 2 columns a name and date and has 398 rows.. In IE 7 and above(and prob previous version) when I open a modal via a button click it takes almost 5 seconds to open. HOWEVER, if I do not bind this datalist it's MUCH faster.. Also this is only happening in IE, Chrome, Firefox and opera both open the modal instantly with the datalist binded... Josh

    Read the article

  • Ensuring the contacts in a Distribution List are displayed with both name and email address

    - by hawbsl
    How can I ensure the contacts I add to an Outlook distribution list are displayed with both name and email address? These contacts may not exist in any other address book, just the distribution list. Currently they show up just as an email address (in both columns). Here's roughly the VBA we're using: Do Until RS.EOF //here's where we want to inject RS!FirstName, RS!Surname etc objRecipients.Add RS!Email objRecipients.Resolve RS.MoveNext Loop Set objDistList = contactsFolder.Items.Add("IPM.DistList") objDistList.DLName = "Whatever" objDistList.AddMembers objRecipients objDistList.Save etc

    Read the article

  • MySQL: How can fetch SUM() of all fields in one Query?

    - by takpar
    Hi, I just want somthing like this: select SUM(*) from `mytable` group by `year` any suggestion? (I am using Zend Framework; if you have a suggestion using ZF rather than pure query would be great!) Update: I have a mass of columns in table and i do not want to write their name down one by one. No Idea??

    Read the article

  • How efficient is a details table?

    - by Jeffrey Lott
    At my job, we have pseudo-standard of creating one table to hold the "standard" information for an entity, and a second table, named like 'TableNameDetails', which holds optional data elements. On average, for every row in the main table will have about 8-10 detail rows in it. My question is: What kind of performance impacts does this have over adding these details as additional nullable columns on the main table?

    Read the article

  • How to retrieve last primary Id from mdb's table?

    - by William
    I got table with next columns: Id, Name, Age, Class I am trying to insert new row in db like this: INSERT INTO MyTable (Name, Age, Class) VALUES (@name, @age, @class) And get an exeption: "Index or primary key cannot contain a Null value." The question is how to add a new row without knowing next primary Id, or maybe there is a way to get this Id from the table with the help of another query ?

    Read the article

  • Generate table schema inspecting Excel(CSV) and import data

    - by Frank Malina
    How would I go around creating a MYSQL table schema inspecting an Excel(or CSV) file. Are there any ready Python libraries for the task? Column headers would be sanitized to column names. Datatype would be estimated based on the contents of the spreadsheet column. When done, data would be loaded to the table. I have an Excel file of ~200 columns that I want to start normalizing.

    Read the article

  • Question on XJB

    - by Hima
    I have two tables -- INSTALL_BUILD_RESULTS and BUILD_RESULTS. IBR has a primary key called Install_Build_Id and BR has a primary key called Build_Id. Both are numbers A third table, LINK_BUILD_TO_INSTALL_BUILD is a table simply consisting of the two columns mentioned above, used together as a composite key. How can I write an xjb for these 3 tables.

    Read the article

  • Sqlite3 and PDO problem with ORDER BY

    - by Maenny
    Hi, I try to use the SQL statement SELECT * FROM table ORDER BY column via an PDO-Object in PHP. Problem is, that I always get an error (Call to a member function fetchall() on a non-object - that means, the query did not return a PDO-object) when using the names of all columnname EXCEPT for ID. When I query SELECT * FROM table ORDER BY ID it works. ID is the PRIMARY INTEGER KEY, all other columns are TEXT or NUMERIC, neither of them would works with the ORDER BY clause. Any ideas?

    Read the article

  • slicing arrays in numpy/scipy

    - by user248237
    I have an array like: a = array([[1,2,3],[3,4,5],[4,5,6]]) what's the most efficient way to slice out a 1x2 array out of this that has only the first two columns of "a"? I.e., array([[2,3],[4,5],[5,6]]) in this case. thanks.

    Read the article

  • DISTINCT clause in SQLite

    - by Eye of Hell
    Hello. Recently i found that SQLite don't support DISTINCT ON() clause that seems postgresql-specific. For exeample, if i have table t with columns a and b. And i want to select all items with distinct b. Is the following query the only one and correct way to do so in SQLite? select * from t where b in (select distinct b from t)

    Read the article

  • What programming shortcuts do you end up regretting or backing out?

    - by bryanjonker
    I saw this question and it reminded me of AutoGenerateColumns in the old DataGrid. The few times I've used them, I ended up backing it out because I needed data formatting past the standard "spit out the Data Source columns." Likewise, with toggle, it sounds like it would save time, but then you end up needing to keep track of state or something else, and you rewrite the code accordingly. Are there things that you end up using thinking it will save you time, but end up backing out because it doesn't do what you need?

    Read the article

  • swing layout: vertical flow

    - by pstanton
    Hi All, What LayoutManager should I use to achieve a transposed version of FlowLayout? Essentially, I want a vertical list which occupies multiple columns if it can't fit all of it's components within one column. +------------------------+ | item 1 | | item 2 | | item 3 | | item 4 | | item 5 | | item 6 | | item 7 | | item 8 | +------------------------+ or +------------------------+ | item 1 item 7 | | item 2 item 8 | | item 3 | | item 4 | | item 5 | | item 6 | +------------------------+

    Read the article

  • ASP.net C# Add controls automatically to a data form

    - by user333817
    I am using ASP.net with C# and am looking for a tool that given a SQL table name, reads the table columns and populates an aspx form with controls (textboxes with matching labels). Something like ComponentOne InputPanel, except that this product only works for WinForms. See demo of ComponentOne InputPanel: http://www.componentone.com/newimages/Products/Videos/StudioEnterprise/InputPanel/ComponentOneInputPanel.html

    Read the article

  • JPA Database strcture for internationalisation

    - by IrishDubGuy
    I am trying to get a JPA implementation of a simple approach to internationalisation. I want to have a table of translated strings that I can reference in multiple fields in multiple tables. So all text occurrences in all tables will be replaced by a reference to the translated strings table. In combination with a language id, this would give a unique row in the translated strings table for that particular field. For example, consider a schema that has entities Course and Module as follows :- Course int course_id, int name, int description Module int module_id, int name The course.name, course.description and module.name are all referencing the id field of the translated strings table :- TranslatedString int id, String lang, String content That all seems simple enough. I get one table for all strings that could be internationalised and that table is used across all the other tables. How might I do this in JPA, using eclipselink 2.4? I've looked at embedded ElementCollection, ala this... JPA 2.0: Mapping a Map - it isn't exactly what i'm after cos it looks like it is relating the translated strings table to the pk of the owning table. This means I can only have one translatable string field per entity (unless I add new join columns into the translatable strings table, which defeats the point, its the opposite of what I am trying to do). I'm also not clear on how this would work across entites, presumably the id of each entity would have to use a database wide sequence to ensure uniqueness of the translatable strings table. BTW, I tried the example as laid out in that link and it didn't work for me - as soon as the entity had a localizedString map added, persisting it caused the client side to bomb but no obvious error on the server side and nothing persisted in the DB :S I been around the houses on this about 9 hours so far, I've looked at this Internationalization with Hibernate which appears to be trying to do the same thing as the link above (without the table definitions it hard to see what he achieved). Any help would be gratefully achieved at this point... Edit 1 - re AMS anwser below, I'm not sure that really addresses the issue. In his example it leaves the storing of the description text to some other process. The idea of this type of approach is that the entity object takes the text and locale and this (somehow!) ends up in the translatable strings table. In the first link I gave, the guy is attempting to do this by using an embedded map, which I feel is the right approach. His way though has two issues - one it doesn't seem to work! and two if it did work, it is storing the FK in the embedded table instead of the other way round (I think, I can't get it to run so I can't see exactly how it persists). I suspect the correct approach ends up with a map reference in place of each text that needs translating (the map being locale-content), but I can't see how to do this in a way that allows for multiple maps in one entity (without having corresponding multiple columns in the translatable strings table)...

    Read the article

  • DB2 timestamp PHP DateTime

    - by Dolfa
    After upgrade to PHP 5.3 my application is returning DB2 columns with Timestamp type as "2010-12-15-10.23.22.716000". This is causing problem for PHP DateTime function, as it fails with Failed to parse time string (2010-12-15-10.23.22.716000) at position 25 (0): Unexpected character It seems its having a problem with too much accuracy in DB2 timestamp. Can I somehow force connection to change timestamp format with it is fetching data into?

    Read the article

< Previous Page | 142 143 144 145 146 147 148 149 150 151 152 153  | Next Page >