Search Results

Search found 6630 results on 266 pages for 'cname record'.

Page 57/266 | < Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >

  • I've got to update a column in one SQL table with a counter stored in another table, and update that

    - by Bucket
    I'm using SQL server 2005 (for testing) & 2007 (for production). I have to add a unique record ID to all the records in my table, in an existing column, using a "last record ID" column from another table. So, I'm going to do some sort of UPDATE of my table, but I have to get the "last record ID" from the other table, increment it, update THAT table and then update my record. Can anyone give me an example of how to do this? Other users may be incrementing the counter also.

    Read the article

  • How to display how many times each records in a table used by other table

    - by Fredy
    I have a problem with my query, below are two tables that tbl_tag and tbl_tag_usedby. I want to show how much of each record in tbl_tag used by record in tbl_tag_usedby. Here is a query that I use: SELECT t.*, COUNT(u.tagid) AS totale FROM tbl_tag t LEFT JOIN tbl_tag_usedby u ON u.tagid = t.id AND t.status =1 GROUP BY u.tagid and the results are as below: In this case the record id from 2 to 6 do not appear in the query results, I want record id from 2 to 6 are also shown and on the field "totale" its value is 0. Can anyone help me?

    Read the article

  • Figuring out the resource a lock in SQL Server 2000 affects

    - by Michael Lang
    I am adding a simple web-interface to show data from a commercial off the shelf (COTS) application. This COTS issues locks on any record the user is actively looking at (whether they intend to edit and update it or not). I have found sp_lock and the Microsoft sp_lock2 scripts and can see the locks, so that's all well and good. However, I cannot figure out how I can tell if a specific record I am about to update has been affected by one of these locks. If I submit the update request and there is in fact a lock, the web-interface will wait indefinitely until the user closes the window in the COTS. How can I either: a) determine before issuing an update that the record has been locked OR b) issue an update that will immediately return with a LOCKED status rather than indefinitely waiting on the COTS user to close their window on that record?

    Read the article

  • Converting json data to an HTML table

    - by dnaluz
    I have an array of data in php and I need to display this data in a HTML table. Here is what an example data set looks like. Array( Array ( [comparisonFeatureId] => 1182 [comparisonFeatureType] => Category [comparisonValues] => Array ( [0] => Not Available [1] => Standard [2] => Not Available [3] => Not Available ) [featureDescription] => Rear Seat Heat Ducts ),) The dataset is a comparison of 3 items (shown in the comparisonValues index of the array) In the end I need the row to look similar to this <tr class="alt2 section_1"> <td><strong>$record['featureDescription']</strong></td> <td>$record['comparisonValues'][0]</td> <td>$record['comparisonValues'][1]</td> <td>$record['comparisonValues'][2]</td> <td>$record['comparisonValues'][3]</td> </tr> The problem I am coming across is how to best do this. Should I create the entire table HTML on the server side pass it over an ajax call and just dump pre-rendered HTML data into a div or pass the json data and render the table client side. Any elegant suggestions? Thanks in advanced.

    Read the article

  • Is there a set based solution for this problem?

    - by NYSystemsAnalyst
    We have a table set up as follows: |ID|EmployeeID|Date |Category |Hours| |1 |1 |1/1/2010 |Vacation Earned|2.0 | |2 |2 |2/12/2010|Vacation Earned|3.0 | |3 |1 |2/4/2010 |Vacation Used |1.0 | |4 |2 |5/18/2010|Vacation Earned|2.0 | |5 |2 |7/23/2010|Vacation Used |4.0 | The business rules are: Vacation balance is calculated by vacation earned minus vacation used. Vacation used is always applied against the oldest vacation earned amount first. We need to return the rows for Vacation Earned that have not been offset by vacation used. If vacation used has only offset part of a vacation earned record, we need to return that record showing the difference. For example, using the above table, the result set would look like: |ID|EmployeeID|Date |Category |Hours| |1 |1 |1/1/2010 |Vacation Earned|1.0 | |4 |2 |5/18/2010|Vacation Earned|1.0 | Note that record 2 was eliminated because it was completely offset by used time, but records 1 and 4 were only partially used, so they were calculated and returned as such. The only way we have thought of to do this is to get all of the vacation earned records in a temporary table. Then, get the total vacation used and loop through the temporary table, deleting the oldest record and subtracting that value from the total vacation used until the total vacation used is zero. We could clean it up for when the remaining vacation used is only part of the oldest vacation earned record. This would leave us with just the outstanding vacation earned records. This works, but it is very inefficient and performs poorly. Also, the performance will just degrade over time as more and more records are added. Are there any suggestions for a better solution, preferable set based? If not, we'll just have to go with this.

    Read the article

  • iphone coredata removing records between two entities connected by relation ship

    - by satyam
    I'm implementing core data in my iphone app. It has two entities. Entity1: LatestData Entity2: LatestDetailedData LatestData has URL, publishedDate, heading LatestDetailedData has URL, NewsDescription, PublishedDate, Author Both entities have same URL for a record. Both the entities are connected with inverse relation ship. And the relation ship is "delete-Cascaded" What I want: If I remove a record in LatestData, I want the record with same URL in LatestDetailedData must also be deleted. How?

    Read the article

  • How to query an XML File with E4X in AS3?

    - by yens resmann
    I need to archive a database-driven flash as3 website. I exported a table to xml so now i have something like this: <RECORDS> <RECORD> <id>home</id> <msg>bodytext</msg> <type>0</type> <lastEditDate>0000/0/0 00:00:00</lastEditDate> <lastAccessDate>2009/6/17 11:37:21</lastAccessDate> <timesAccessed>855</timesAccessed> </RECORD> <RECORD> <id>contact</id> <msg>contact body text</msg> <type>0</type> <lastEditDate>0000/0/0 00:00:00</lastEditDate> <lastAccessDate>2010/5/6 20:40:46</lastAccessDate> <timesAccessed>831</timesAccessed> </RECORD> </RECORDS> Now I would like to select the RECORD where id is set to home. In SQL: SELECT * FROM table WHERE id='home' How can i do the same thing with E4X for AS3 ?

    Read the article

  • object references an unsaved transient instance

    - by developer
    Hi, I have 2 tables, user and userprofile, both with almost identical fields. user table references userprofile table by primary key ID. My requirement is that on click of a button I need to dump user table record to userprofile table. Now for a particular user table, if there is a corresponding userprofile entry, I am successfully able to dump the data, but if there is no record in userprofile table then I need to create a new record by dumping all the data. My problem is that I am able to update the data when the record is present in userprofile table, but in the case wherein I have to create a new record I get the below error "object references an unsaved transient instance - save the transient instance before flushing". `<class name="User"> <id name="ID" type="Int32"> <generator class="native" /> </id> <many-to-one name="Pid" class="UserProfile" /> </class>` UserProfile is another table and Pid above references the Primary key ID of UserProfile table.

    Read the article

  • MS Access Form - Horizontal Anchor Affecting Data Update

    - by nicholas
    Running Access 2007 with a databound form. The form Record Source is set to a query, and all fields in the form have a defined Control Source; nothing fancy, just field names. The form is a Single form with record navigation buttons which perform a "Next Record" and "Previous Record" actions. As I navigate the records the controls in the header update correctly. However, if I change a control Horizontal Anchor property to "Right" the fields no longer update on record navigation. This is observed for both text box and combo box controls. I can switch the anchoring back to "Left" and the updating works as it should. Is there some reason anchoring would affect a control updating of in an Access form? Or is this a bug that has been observed before? The only workaround I can think of is to assign the control text/value property in the form OnCurrent event, but this seems somewhat sloppy. Am I missing something here?

    Read the article

  • Way to check for foreign key references before deleting in MySQL?

    - by Chad Johnson
    I'm working with a content management system, and users are prompted with a confirmation screen before deleting records. Some records are foreign key referenced in other tables, and therefore they cannot be deleted. I would like to display a message beside a given record if it has foreign key references. To know whether I should display the message for a record, I could just query the referencing table and see if there are references. But the problem is, there are about a dozen tables with records potentially referencing this record, and a lookup could take a "long" time. Is there an easy way to tell whether the record is delete-ready (ie. has no foreign key references)?

    Read the article

  • Testing stored procedures

    - by giri
    Hi , How to test procedures with record type parameters.I have a procedure which takes test_ap ,basic and user_name as inputs.where test_ap is of record/row type,basic record array type and user_name charater varying. I need to test the procedure in pgadmin. test_client(test_ap test_base, basic test_base_detail[], user_name character varying) Any suggestions plz.

    Read the article

  • why is ADODB inserting NULL values on update?

    - by every_answer_gets_a_point
    i have: With rs .AddNew ' create a new record ' add values to each field in the record .Fields("datapath") = dpath .Fields("analysistime") = "atime" .Fields("reporttime") = "rtime" .Fields("lastcalib") = "lcalib" .Fields("analystname") = "aname" .Fields("reportname") = "rname" .Fields("batchstate") = "bstate" .Fields("instrument") = "NA" .Update ' stores the new record End With when i check the database, it looks like it ONLY inserted the last field! has anyone encountered this problem?

    Read the article

  • Query between SQL server and Client side

    - by Karim
    I create a query: Select * from HR_Tsalary where month='3' and year ='2010' the result is 473 records and I found 2 duplicate record, then I create another query to find duplicate record only: SELECT Emp_No, COUNT(*) FROM HR_Tsalary WHERE year = '10' AND month = '3'GROUP BY Emp_No HAVING COUNT(*) 1 the result is zero record from client side (thru Visual Basic Adodb code). But when I use same query from server the result is 2 records. Is there any different when create a query between from server side and client side?

    Read the article

  • Unique number identifier generation

    - by xwrs
    I have to create logic for generation unique number identifier for records in database. id, generated in database is a separate column. At this moment, when user calls "create record" action, I save new record, get its database id, generate record number using this id, then put it to the edit form. Using this way means that all entity fields should be nullable to save record to database. I don't like this way. I know that should be better way. Is there a better practice to generate unique number identifier? What is possibility of generating non-unique random numbers? Thank you

    Read the article

  • SQL Delete Query

    - by jerle78
    I need to write an SQL script that selects one record in table1, then does a lookup in the remaining tables in the database. If it doesn't find the record, I need delete the record from table1. Anyone provide some sample script?

    Read the article

  • Sort MySQL result set using comparison between 2 columns of same value type

    - by Kyobul
    Hello, I have a table containing last_updated_1 and last_updated_2 columns, used respectively for text and images update time on a post. I wish I could get a result set of 10 rows based on all time last updated records contained in the 2 columns, ex. row 1 = last_updated_1 record, row 2 = last_updated_2 record, row 3 = last_updated_1 record, etc. How could I compare inside a MySQL query the both columns values, to get unique & mixed result set ? Thank you in advance for your help

    Read the article

  • SQL ENQUIRY In how to Get defined number of records

    - by ramadan2050
    I have a select statement, retrieve about 1000 record I want to modify it to return only some records defined by @startIndex and @count e.g. : If I said @startIndex=20 and @count=20 the result will be : from the 21th record to 40th I try to make it, but it take the same time as if I retrieve the 1000 record what is the best way to do that

    Read the article

  • what does select @@identity do?

    - by every_answer_gets_a_point
    i am connecting to a mysql database through excel using odbc what does this line do? Set rs = oConn.Execute("SELECT @@identity", , adCmdText) i am having trouble updating the database: With rs .AddNew ' create a new record ' add values to each field in the record .Fields("datapath") = dpath .Fields("analysistime") = atime .Fields("reporttime") = rtime .Fields("lastcalib") = lcalib .Fields("analystname") = aname .Fields("reportname") = rname .Fields("batchstate") = "bstate" .Fields("instrument") = "NA" .Update ' stores the new record End With it is ONLY updating .Fields("instrument") = "NA", but for all other fields it is putting NULL values

    Read the article

  • passing an extra parameter in jobschedule in node.js

    - by Sush
    Is there any possible way to pass any extra parameter instead of date in schedule.scheduleJob(date,function(id)) The below code is not working var id =record.id; var date =record.date; jobsCollection.save({ id: record.id }, { $set: record }, function (err, result) { var j = schedule.scheduleJob(date, function (id) { return function () { console.log("inside----------") console.log(id) }; }(id)); if (!err) { return context.sendJson([], 404);; } }); i want to pass the date along with another data to schedule jobs. so that i can perform other operations based on the date schedule and that id

    Read the article

  • How can I do a left outer join where both tables have a where clause?

    - by cdeszaq
    Here's the scenario: I have 2 tables: CREATE TABLE dbo.API_User ( id int NOT NULL, name nvarchar(255) NOT NULL, authorization_key varchar(255) NOT NULL, is_active bit NOT NULL ) ON [PRIMARY] CREATE TABLE dbo.Single_Sign_On_User ( id int NOT NULL IDENTITY (1, 1), API_User_id int NOT NULL, external_id varchar(255) NOT NULL, user_id int NULL ) ON [PRIMARY] What I am trying to return is the following: is_active for a given authorization_key The Single_Sign_On_User.id that matches the external_id/API_User_id pair if it exists or NULL if there is no such pair When I try this query: SELECT Single_Sign_On_User.id, API_User.is_active FROM API_User LEFT OUTER JOIN Single_Sign_On_User ON Single_Sign_On_User.API_User_id = API_User.id WHERE Single_Sign_On_User.external_id = 'test_ext_id' AND API_User.authorization_key = 'test' where the "test" API_User record exists but the "test_ext_id" record does not, and with no other values in either table, I get no records returned. When I use: SELECT Single_Sign_On_User.id, API_User.is_active FROM API_User LEFT OUTER JOIN Single_Sign_On_User ON Single_Sign_On_User.API_User_id = API_User.id WHERE API_User.authorization_key = 'test' I get the results I expect (NULL, 1), but that query doesn't allow me to find the "test_ext_id" record if it exists but would give me all records associated with the "test" API_User record. How can I get the results I am after?

    Read the article

  • Audit many-to-many relationship in NHibernate

    - by Kendrick
    I have implemented listeners to audit changes to tables in my application using IPreUpdateEventListener and IPreInsertEventListener and everything works except for my many-to-many relationships that don't have additional data in the joining table (i.e. I don't have a POCO for the joining table). Each auditable object implements an IAuditable interface, so the event listener checks to see if a POCO is of type IAuditable, and if it is it records any changes to the object. Look up tables implement an IAuditableProperty inteface, so if a property of the IAuditable POCO is pointing to a lookup table, the changes are recorded in the log for the main POCO. So, the question is, how should I determine I'm working with a many-to-many collection and record the changes in my audit table? //first two checks for LastUpdated and LastUpdatedBy ommitted for brevity else if (newState[i] is IAuditable) { //Do nothing, these will record themselves separately } else if (!(newState[i] is IAuditableProperty) && (newState[i] is IList<object> || newState[i] is ISet)) { //Do nothing, this is a collection and individual items will update themselves if they are auditable //I believe this is where my many-to-many values are being lost } else if (!isUpdateEvent || !Equals(oldState[i], newState[i]))//Record only modified fields when updating { changes.Append(preDatabaseEvent.Persister.PropertyNames[i]) .Append(": "); if (newState[i] is IAuditableProperty) { //Record changes to values in lookup tables if (isUpdateEvent) { changes.Append(((IAuditableProperty)oldState[i]).AuditPropertyValue) .Append(" => "); } changes.Append(((IAuditableProperty)newState[i]).AuditPropertyValue); } else { //Record changes for primitive values if(isUpdateEvent) { changes.Append(oldState[i]) .Append(" => "); } changes.Append(newState[i]); } changes.AppendLine(); }

    Read the article

  • An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING cla

    - by brz dot net
    I have to find the indentid from the status table based on below two conditions: 1. If there are more than one record having same indentid in status table and the same indentID has count1 in feasibilitystatus table then I don't want to display the record. 2. If there is only one record of indentid in status table and the same indentID has count0 in feasibilitystatus table then I don't want to display the record. Query: select distinct s.indentid from status s where s.status='true' and s.indentid not in(select case when count(s.indentid)>1 then (select indentid from feasibilitystatus group by indentid having count(indentid)>1) else (select indentid from feasibilitystatus group by indentid having count(indentid)>0) end as indentid from status) Error: An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.

    Read the article

  • Entity framework Update fails when object is linked to a missing child

    - by McKay
    I’m having trouble updating an objects child when the object has a reference to a nonexising child record. eg. Tables Car and CarColor have a relationship. Car.CarColorId CarColor.CarColorId If I load the car with its color record like so this var result = from x in database.Car.Include("CarColor") where x.CarId = 5 select x; I'll get back the Car object and it’s Color object. Now suppose that some time ago a CarColor had been deleted but the Car record in question still contains the CarColorId value. So when I run the query the Color object is null because the CarColor record didn’t exist. My problem here is that when I attach another Color object that does exist I get a Store update, insert error when saving. Car.Color = newColor Database.SaveChanges(); It’s like the context is trying to delete the nonexisting color. How can I get around this?

    Read the article

< Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >