Hi,
Post Update: I have tracked down the problem at the command "ExecuteNonQuery". That's the one that fails during an update or hangs during an insert. Trying a simple example using plain ADO.NET and their transactions works perfect. Also... it works great on my local home computer connection an Oracle Express edition. Pointing it agai...
I have to insert 8000+ records into a SQLite database using Django's ORM. This operation needs to be run as a cronjob about once per minute. At the moment I'm using a for loop to iterate through all the items and then insert them one by one.
Example:
for item in items:
entry = Entry(a1=item.a1, a2=item.a2)
entry.save()
What is...
I have a Silverlight application and I'm using a WCF service to access my database information. For this I'm using EntityFramework. I have a class Items (mapped on my DB table Items) which has an ObservableCollection of Keywords (class mapped on my DB table Keywords) objects.
From the interface I create an Items object with all the pro...
I'm using a database as a kind of cache - the purpose is to store currently known "facts" (the details aren't that interesting). Crucially, however, I'd like to avoid inserting duplicate facts. To do so, the current data access code uses insert or ignore in many places.
I'd like to use the entity framework to benefit from it's managea...
I am using NHibernate 2.1.0.4000 in one of the projects. I have set adonet.batch_size to 100 in the cfg file however I still see that insert statement is treated as single statement. Update seems to work fine. What's going on?
Updated:
Is it because I've chosen identity as the primary key generator?
<id name="Id" column="Id" unsaved-v...
NO MySQL answers please!
The basic query is as follows (assume A is Key)
INSERT INTO destination (A,B,C)
SELECT a1,b1,c1
FROM source
WHERE (selectconditions) ;
Source contains many records that may or may not already be in destination, which means that the insert will fail as soon as a duplicate record is encountered.
Desired Behav...
I would like to take two separate strings of value pairs delimited by commas and insert each pair into a row in the database.
For example:
X = "1,2,3" Y = "A,B,C" => X | Y
---------
1 | A
2 | ...
A quick question.
I'm using php to insert new records in a database table - if the record exists, an update command is run instead.
My question is, if the incoming record has fields that are empty but the data already in the database is not empty, does the update command overwrite the existing data with the empty values?
Much appreci...
Hi,
Maybe I'm just spoiled by SQL, but is there some cool LINQ way to insert a new record into an "XML table" and have the indexed ID update automatically (or at least semi-automatically)?
Here's what I mean by "XML table":
<myElements>
<myElement>
<id>1</id>
<value>blah</value>
</myElement>
<myElement>
<id>...
I am inserting a row into a table and would like to get the value of the automatically incremented primary index.
The primary index is the only unique value in the table so I don't want to do anything like "SELECT [primary index] FROM [table] WHERE [the columns = the data I just inserted]" to prevent ambiguity. I also don't want to SELE...
Hello,
I am currently using this type of SQL on MySQL to insert multiple rows of values in one single query:
INSERT INTO tbl (key1,key2) VALUES ('r1v1','r1v2'),('r2v1','r2v2'),...
On the readings on PDO PDO, the use prepared statements should give me a better security than static queries.
I would therefore like to know whether ...
Hi,
I'm having a weird problem with adding stuff to my Container. Whenever I try to add the items it simply exits the while loop, even though isServer is still 1. I've tried to make a custom function, same result. Then i tried calling the Add(..) function directly and still same result. I don't see how inserting items to my container is...
If the next is right:
There are SQL string with multiple inserts (using a stored procedure):
"EXEC SPInsertData ... EXEC SPInsertData ... EXEC SPInsertData ..."
The id in identity column, which is auto incremented, of every new record is smaller than the id of the next one.
E.g. after executing the given SQL string the id of the first...
I may have either misunderstood how to use the ON DUPLICATE KEY syntax, alternatively my database structure needs some work but here goes.
I have a table (bookings-meta) which represents meta data associated with another table (bookings) , different rows in the bookings table may or may not have specific meta data associated with them i...
declare @@newid int, @@newRequestId int
INSERT INTO Projects (ProjectName)
VALUES ('first')
SELECT [@@newId] = SCOPE_IDENTITY()
-- Insert statements for procedure here
INSERT INTO Requests
(projectId, Title, RequestedBy, ReviewedBy, AssignedTo, EstimatedHours, ActualHours,
Status, DateCreated, DateDue, DateAssigned, DateQC, De...
I want to insert n records into a single table. There may be many concurrent users and they may insert/update/select data from this table. What is better way to insert in a such table say 1000 records:
Send a single sql query to a database with multiple inserts. This saves server to database calls, but (I not sure) locks the table unti...
I have created a single table in my primary DB called tblGlobalIDMapping that will assign a GUID to all entries and store the other 3 primary ID's across the App to provide for a single ID repository.
The new Table is in the following structure -->
AppGlobalID uniqueidentifier NoNulls
PersonID int NoNul...
DbCommand command = new OracleCommand(
"insert into hardware (HardwareID) VALUES (6);", myConnection);
command.ExecuteNonQuery();
Hardware is a NUMBER(7, 0).
I am trying to make this simple Oracle INSERT work using C#. However, I keep getting an 911 error saying that there is an invalid character.
What am I doing wrong?
I ca...
Consider the following:
I have a high level component that deals with detached Linq to Sql entities. We'll call them Foo and Prop, where a single Foo may be associated with many Prop, but every Prop is always associated with exactly one Foo. So:
+------+ 1 0..n +------+
| Foo |-----------| Prop |
+------+ +------+
Ver...
I would like to have a trigger to perform following operation for inserted records:
# pseudocode
if new.group_id is null
set new.group_id = new.id
else
# don't touch it
end
More clearly: say I have one table with three columns: id primary key, group_id int, value varchar.
When I insert with group_id like that:
INSERT INT...