insert

openxml - inserting a row, moving others

Hi there, I am using openxml to create an excel report. The openxml operates on a template excel file using named ranges. The client requires a totals row at the end of the list of rows. Sounds like a reasonable request!! However, the data table I'm returning from the db can contain any number of rows. Using template rows and 'InsertB...

SQL INSERT: skip values allready present

Hi, I'm trying to add sequence of tags to a list subjects. I wouldn't make unique tag column field because I may have the same duplicate depending by the user language like in the example table_houses id name location 1 Victoria's Home New York 2 Black Mesa Lab New Mexico ...

MySQL: Insert if foreign key exists

I have an excel sheet with around 2.000 rows that i want to insert into my database. The problem is that the table i want to insert the 2.000 rows into has a field that references to a foreign key in another table. Unfortunately a lot of queries fail, since the given foreign key does NOT exist. I know that I can ignore foreign key chec...

Adding table lock manually to specified table in SQL Server

I want to INSERT into one tables but prevent INSERTING to another one. It is possible to LOCK for example table a for INSERTING, INSERT to table b and then UNLOCK table a? TABLOCK can lock only the table I am INSERTING in. Thanks Martin Pilch ...

SQLite iPhone - Insert Fails

Hi, I am trying to insert a value to a SQLite db, but everytime I try my program simply crashes with no error message at all. Here is my code: - (void) insertToDatabase:(NSString *) refName { // The Database is stoed in the application bundle NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomai...

Problem with R console

I have a little problem with my R console recently. When I start R ("C:\Program Files\R\R-2.8.1\bin\Rgui.exe"), the cursor immediately starts in INSERT mode (thick state). Then I have to press Insert and toggle it to normal mode (thin state). As soon as I write a command line and hit Enter, the cursor again toggles to INSERT mode. I don'...

Very slow TRUNCATE accompanied with "Server seems busy" on httpd log

I have this very simple table with only 35 rows on 5 simple columns (primary key on id auto increment, title (varchar), a bool, and 2 datetime). As we work in team, we import data from Google Docs, rephrase it as a SQL to do a TRUNCATE->LOCK TABLE WRITE->INSERT INTO (multiple lines)->UNLOCK TABLE at once. On other bigger, more complicate...

MySQL Transaction handling with Insert Ignore (or similar) and Unique IDs

I'm using MySQL + PHP. I have some code that generates payments from an automatic payment table based on when they are due (so you can plan future payments... etc). The automatic script is run after activity on the site and sometimes gets run twice at the same time. To avoid this, we generate a uuid for a payment where there only can be ...

How to replicate :new trigger functionality from Oracle to Sybase

I am trying to convert code from Oracle to Sybase, where there are manipulations occurring on the :new.x values. These triggers are BEFORE INSERT, so whatever changes in the :new values are replicated in the insert into the table the trigger is placed on. The Sybase triggers are fired after insert, but I can't seem to work out how to ge...

help with insert mysql

Hi-- I have some data from an old table, with a lot of columns that I need to insert into a new table, with not quite as many columns. If you simply try to import the sql dump data from the old table directly into the new one, you get an error: Unknown column 'fake' in 'field list' Is there a way to make this ignore the errors (IN...

How do/can I run a select SQL statement inside an if?

I'm having trouble finding the syntax for a statement (or whether or not it's even possible). We're running SQL Server 2005, and I'd like to do something like: IF ((SELECT count(*) FROM mytable WHERE userid = 'myid' AND value = 3) < 1) then INSERT INTO mytable VALUES ('myid', 3) Any suggestions? Thanks ...

How to Stop Hibernate From Trying to Update one-to-many Over Join Table

Ok so I'm having bit of a problem with my Hibernate mappings and getting the desired behavior. Basically what I have is the following Hibernate mapping: <hibernate-mapping> <class name="com.package.Person" table="PERSON" schema="MYSCHEMA" lazy="false"> <id name="personId" column="PERSON_ID" type="java.lang.Long"> ...

oracle insert if row not exists

insert ignore into table1 select 'value1',value2 from table2 where table2.type = 'ok' When I run this I get the error "missing INTO keyword" . Any ideas ? ...

There are fewer columns in the INSERT isn't the answer

Hello, I have an application that converts one database to another and one of the functions I use is insert_Note below. This application has multipule threads all inserting diffrent data into the new database. The code below works for a number of inserts ranging between 24 and 120 but then fails with the error: There are fewer columns ...

Inserting Array References into Perl Heap

I am inserting 2-dimensional array references into my heap in Perl. How should I define the 'elements' attribute when constructing my heap so that I can properly use my comparator function? my $heap = Heap::Simple->new( order => \&byNumOrStr, elements => [Array => 0] ); ...

How to insert the contents of a text file into a table in SQL Server

I have several files (they are XML but that's not important) that need to be inserted into an existing SQL table (i.e. I didn't design it.) The table looks like this. ReportType ID (int) <- identity Name (varchar(32)) TransformXSLT (nvarchar(max)) Normally I would do: INSERT INTO ReportType (Name, TransformXSLT) VALUES ('templa...

Inserting a custom Postgres datatype with PHP

CREATE TYPE mpaa_rating AS ENUM ( 'G', 'PG', 'PG-13' ); CREATE TABLE film ( film_id integer DEFAULT nextval('film_film_id_seq'::regclass) NOT NULL, rating mpaa_rating DEFAULT 'G'::mpaa_rating ); I've tried the following: pg_insert($dbconn, "film", new array("rating" => "PG")); pg_insert($dbconn, "film", new array...

Why is my insert not working in php?

I have an insert statement I am querying to the DB. $notes_sql = 'INSERT into notes SET order_id = "'.$_GET['order_id'].'", date_added = "'.$date_added.'", note_message = "'.$_SESSION['note_message'].'"'; $notes_result = $conn->query($notes_sql) or die(mysqli_error($conn)); I know the sql sta...

jqGrid Insert New Row Custom

I have looked around and have yet to find a decent answer. I wish to add a new row into my grid from my own custom button, without using their add buttom or edit forms. Something like: $("#grid").jqGrid('insert',{"id","col1","col2"}); I want to be able to programatically insert new rows and not have to use their form. Any help woul...

SQL Server insert statement using INSERTED to get new ID and existing ID

Hello SO, I'm inserting records from one sql server db into another. I need to get the newly inserted id and update a field on the source table. I can get the new ID with INSERTED option no problem. However, I cannot seem to get the ID from the source table. The destination table does not have a field for the source's ID. The source tab...