Search Results

Search found 12215 results on 489 pages for 'identity column'.

Page 71/489 | < Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >

  • Oracle ODBC x64 - getting 0 when selecting a number(9) column

    - by MatsL
    I'm having a really weird problem with a third party web service that uses an ODBC connection to Oracle 10.2.0.3.0. I've written a .NET client that generates the same SQL as the web service so I can find out what's going on. The web service is hosted by IIS 6 that's in x64 mode so we use Oracle x64 client. The oracle client version is 10.2.0.1.0. I have a table that looks like this (I've removed some columns and names): SQL> describe tablename; Name Null? Type ----------------------------------------- -------- ---------------------------- KOD VARCHAR2(30) ORDNING NUMBER(5) AVGIFT NUMBER(9) I then in SQL*Plus issue the following statement: SELECT KOD as kod, AVGIFT as riskPoang FROM tablename Where upper(KODTYP) = 'OBJLIVSV_RISKVERKSAMTYP' ORDER BY ORDNING And I get the following result: KOD RISKPOANG ------------------------------ ---------- Hög risk 55 Mellan risk 35 Låg risk 15 Mycket låg risk 5 But when I execute the exact same SQL using the same DSN on the same machine I get this: Values Kod: Hög risk RiskPoäng: 0 Kod: Mellan risk RiskPoäng: 0 Kod: Låg risk RiskPoäng: 0 Kod: Mycket låg risk RiskPoäng: 0 If I first cast the number to varchar and then back again to number, like this: SELECT KOD as kod, to_number(to_char(AVGIFT, '99'), '9999999999') as riskPoang FROM tablename Where upper(KODTYP) = 'OBJLIVSV_RISKVERKSAMTYP' ORDER BY ORDNING I get the correct result: Values Kod: Hög risk RiskPoäng: 55 Kod: Mellan risk RiskPoäng: 35 Kod: Låg risk RiskPoäng: 15 Kod: Mycket låg risk RiskPoäng: 5 Has anyone else experiences this? It's incredibly annoying and I'm completely stuck and not sure what to do next. We have a third party web service that use these tables so I must get the original SQL-statement to work since I can't modify its code. And pointers are greatly appreciated! :-) Best regards, Mats

    Read the article

  • Single Column Multiple Filter In Mysql Intersection

    - by Jeebus
    Here is a table CarID| Attribute | Value 1 | Color | Red 2 | Color | Blue 3 | Color | Red 1 | Type | Coupe 2 | Type | Hatch Back 3 | Type | Coupe 3 | Make | Honda 2 | Make | Toyota 1 | Make | Ford Now I would like to run a filter Like Select * From Cars WHERE (Attribute = Color AND Value = Red) AND (Attribute = Make AND Value = Honda).... and Hope to get the CarID as 3 ! This is simple case of Intersection of 2 queries but I don't know how to get it done in a single query. Any help appriciated.

    Read the article

  • Using SQL dB column as a lock for concurrent operations in Entity Framework

    - by Sid
    We have a long running user operation that is handled by a pool of worker processes. Data input and output is from Azure SQL. The master Azure SQL table structure columns are approximated to [UserId, col1, col2, ... , col N, beingProcessed, lastTimeProcessed ] beingProcessed is boolean and lastTimeProcessed is DateTime. The logic in every worker role is: public void WorkerRoleMain() { while(true) { try { dbContext db = new dbContext(); // Read foreach (UserProfile user in db.UserProfile .Where(u => DateTime.UtcNow.Subtract(u.lastTimeProcessed) > TimeSpan.FromHours(24) & u.beingProcessed == false)) { user.beingProcessed = true; // Modify db.SaveChanges(); // Write // Do some long drawn processing here ... ... ... user.lastTimeProcessed = DateTime.UtcNow; user.beingProcessed = false; db.SaveChanges(); } } catch(Exception ex) { LogException(ex); Sleep(TimeSpan.FromMinutes(5)); } } // while () } With multiple workers processing as above (each with their own Entity Framework layer), in essence beingProcessed is being used a lock for MutEx purposes Question: How can I deal with concurrency issues on the beingProcessed "lock" itself based on the above load? I think read-modify-write operation on the beingProcessed needs to be atomic but I'm open to other strategies. Open to other code refinements too.

    Read the article

  • SQL Alias as Table.column

    - by bakerjr
    hi, is it possible to alias an aggregate function in a select clause as AliasTable.AliasColumn? The reason is because I want minimum modifications in my arrays (I'm using PHP). Thanks! P.S. I'm using SQl Server 2008

    Read the article

  • How to save multiple column in database

    - by shamim
    I have a text file.I need to get data from this text file and show on grid , 1)After this user can update information from gridview, 2)Click on save button save data on database. Before clicking on button data don't save on database.How to do that?

    Read the article

  • Retrieve part of a MySQL column with PHP

    - by Gerardo Marset
    For instance, if I have the following table: +----+---+----------+ | id | a | position | +----+---+----------+ | 0 | 0 | 0 | | 1 | 0 | 1 | | 2 | 1 | 4 | | 3 | 1 | 9 | | 4 | 1 | 6 | | 5 | 1 | 1 | +----+---+----------+ and I want to get an array that contains the first 100 values from position where a is 1 in ascending order, what would I do? Im guessing something like this: $col = mysql_fetch_array( mysql_query(' SELECT `position` FROM `table` WHERE `a`="1" ORDER BY `position` ASC LIMIT 100 ')); I'd expect to get the following array: +-------+-------+ | index | value | +-------+-------+ | 0 | 1 | | 1 | 4 | | 2 | 6 | | 3 | 9 | +-------+-------+ but it doesn't work. ¿What should I do to make it work? Thanks

    Read the article

  • Mysql join two tables and add column values

    - by Mike
    My knowledge of mysql is not very in depth. If I have two tables that for example look like this: Table1 Date v1 v2 v3 05/01/2010 26 abc 45 05/02/2010 31 def 25 05/03/2010 50 ghi 46 Table2 Date v1 v2 v3 05/01/2010 42 jkl 15 05/02/2010 28 mno 14 05/03/2010 12 pqr 64 How can I join them in a query by their date and have the sum of table1.v1 and table2.v1 and also have the sum of table1.v3 and table2.v3. V2 should be ignored.

    Read the article

  • A simple two column layout with Swing

    - by Derk
    How to get a sidebar JPanel of a fixed with with Swing. Now I'm trying this: public SidebarPanel() { this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); this.setPreferredSize(new Dimension(200, this.getPreferredSize().height)); ... But when I resize the window also the width of the sidebar changes. How to fix this?

    Read the article

  • Encrypt column data with LINQ

    - by kape123
    I was wondering if there is easy solution to this or I'm stuck with following: When updating DB: dti.Pass = Crypter.Encrypt(dti.Pass); _db.SubmitChanges(); When selecting from DB: Data.DbTableItem dti = _db.Single(a=a.Id == id); dti.Pass = Crypter.Decrypt(dti.Pass); Meaning - I am not really into writing repetitive code and this seems like logical thing to be supported by LINQ; so I'm wondering if it is.

    Read the article

  • SQL Query Help - Return row in table which relates to another table row with max(column)

    - by Seth
    I have two tables: Table1 = Schools Columns: id(PK), state(nvchar(100)), schoolname Table2 = Grades Columns: id(PK), id_schools(FK), Year, Reading, Writing... I would like to develop a query to find the schoolname which has the highest grade for Reading. So far I have the following and need help to fill in the blanks: SELECT Schools.schoolname, Grades.Reading FROM Schools, Grades WHERE Schools.id = (* need id_schools for max(Grades.Reading)*)

    Read the article

  • Select column value that matches a combination of other columns values on the same table

    - by Ala
    I have a table called Ads and another Table called AdDetails to store the details of each Ad in a Property / Value style, Here is a simplified example with dummy code: [AdDetailID], [AdID], [PropertyName], [PropertyValue] 2 28 Color Red 3 28 Speed 100 4 27 Color Red 5 28 Fuel Petrol 6 27 Speed 70 How to select Ads that matches many combinations of PropertyName and PropertyValue, for example : where PropertyName='Color' and PropertyValue='Red' And where PropertyName='Speed' and CAST(PropertyValue AS INT) > 60

    Read the article

  • Rails Model multiple column uniqueness

    - by Jty.tan
    I am making a Viewer model with belongs_to :users belongs_to :orders that joins the models Users and Orders with a :has_many :through => :viewers. And the Viewer model has the attributes of user_id and order_id. How would I set it up so that new viewers are only accepted if both user_id and order_id are unique in the same row? I remember in MySQL being able to do so with a flag (although I can't for the life of me remember what it was), but I'm not sure how to do it with Rails. Can I do something like (for Viewer.rb) validates_uniqueness_of :user_id, :scope => :order_id?

    Read the article

  • SQL Server Concatenate string column value to 5 char long

    - by mrp
    Scenario: I have a table1(col1 char(5)); A value in table1 may '001' or '01' or '1'. Requirement: Whatever value in col1, I need to retrive it in 5 char length concatenate with leading '0' to make it 5 char long. Technique I applied: select right(('00000' + col1),5) from table1; I didn't see any reason, why it doesn't work? but it didn't. Can anyone help me, how I can achieve the desired result?

    Read the article

  • Entity Framework 4.1 (Code First) audit column

    - by Ken Pespisa
    I'm using Entity Framework 4.1 with a Code-First approach on an ASP.NET MVC site Say I have an entity named Profile that keeps track of a user's favorite book, and I want to track when the user updates their favorite book. UPDATED: Using the class below as an example, I want to set the FavoriteBookLastUpdated property to the current date whenever the value of the FavoriteBook property changes. public class Profile { public int Id { get; set; } public string Name { get; set; } public string FavoriteBook { get; set; } public DateTime? FavoriteBookLastUpdated { get; set; } } Right now I just update that field, if appropriate, in the controller's Edit action before calling the DBContext's SaveChanges() method. Is there a way I can put that logic in my model somehow? I'd prefer not to use triggers on the database side.

    Read the article

  • Querying datatable to get rows with a certain value in the first column

    - by user1776590
    I am currently using the code below and am wondering if it would be possible to query based on an entry value. At the moment it returns the number of rows that have been defined. var q = sqlData.AsEnumerable().Take(2); This data comes in from a database and is imputed into the table but at the moment it only returns database data into the datatable and allows me to select the first two rows and I was wondering if I can query the data table so that I can get the rows that I require based on an index in the actual table itself (e.g. in the table I find five rows and query this information out).

    Read the article

  • Get a DB result with a value between two column values

    - by vitto
    Hi, I have a database situation where I'd like to get a user profile row by a user age range. this is my db: table_users username age email url pippo 15 [email protected] http://example.com pluto 33 [email protected] http://example.com mikey 78 [email protected] http://example.com table_profiles p_name start_age_range stop_age_range young 10 29 adult 30 69 old 70 inf I use MySQL and PHP but I don't know if there is some specific tacnique to do this and of course if it's possible. # so something like: SELECT * FROM table_profiles AS profiles INNER JOIN table_users AS users # can I do something like this? ON users.age IS BETWEEN profiles.start_age_range AND profiles.stop_age_range

    Read the article

  • SQL column length query

    - by Mike
    i've been using the following query: select LEN(columnname) as columnmame from dbo.amu_datastaging This works, but is there a way to only return the greatest value instead of all the values? So if i return 1million records and the longest length is 400, the query would just return the value of 400?

    Read the article

  • Set Jtable/Column Renderer for booleans

    - by twodayslate
    Right now my Boolean values for my JTable display as JCheckBoxes. This would normally be fine but I would like to display them as either an alternative String or image. I can get them to display as true/false but I would like to display them as a checkmark (?) if true and nothing if false. Possibly an image but lets do a String first...

    Read the article

  • Compare values in each column of two Oracle Types

    - by colinjameswebb
    I've been playing around with the pluto-test-framework today, and I'd like to get some existing functions into a test harness with it. I have lots of functions with this type of specification. FUNCTION DO_SOME_STUFF (pOldSchedule IN SCHEDULE_OBJ, pNewSchedule OUT SCHEDULE_OBJ, pLoggerContext IN OUT LOGGER_CONTEXT_OBJ) RETURN NUMBER; It takes pOldSchedule, does some stuff to it, and then returns pNewSchedule. The logger_context just does logging. As part of a test, I'd like to be able to compare the values in each of the columns of the type, without having to write individual IF statements. It'll need to return boolean to signify whether or not pOldSchedule and pNewSchedule match. Any ideas?

    Read the article

  • SQL 2005 Merge / concatenate multiple rows to one column

    - by Dave
    Hi, We have a bit of a SQL quandry. Say I have a results that look like this... 61E77D90-D53D-4E2E-A09E-9D6F012EB59C | A 61E77D90-D53D-4E2E-A09E-9D6F012EB59C | B 61E77D90-D53D-4E2E-A09E-9D6F012EB59C | C 61E77D90-D53D-4E2E-A09E-9D6F012EB59C | D 7ce953ca-a55b-4c55-a52c-9d6f012ea903 | E 7ce953ca-a55b-4c55-a52c-9d6f012ea903 | F is there a way I can group these results within SQL to return as 61E77D90-D53D-4E2E-A09E-9D6F012EB59C | A B C D 7ce953ca-a55b-4c55-a52c-9d6f012ea903 | E F Any ideas people? Many thanks Dave

    Read the article

  • SQL Server Concatinate string column value to 5 char long

    - by mrp
    Scenario: I have a table1(col1 char(5)); A value in table1 may '001' or '01' or '1'. Requirement: Whatever value in col1, I need to retrive it in 5 char length concatenate with leading '0' to make it 5 char long. Technique I applied: select right(('00000' + col1),5) from table1; I didn't see any reason, why it doesn't work? but it didn't. Can anyone help me, how I can achieve the desired result?

    Read the article

< Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >