insert

In an SSIS package, how do you insert master-detail records?

I have a data flow task that extracts data from one database and inserts into a SQL Server database. After each record is inserted in the master row I also need to insert rows into a detail table. The data for the detail table is pretty simple and can be calculated. How do I retrieve the value of the identity column after inserting? Ho...

SQL INSERT/SELECT where not in insert table

INSERT INTO `tableA` SELECT `Col1`, `Col2`, NOW() FROM `tableB` WHERE tableA.Col1 is not already in tableB.Col1 I can't get the WHERE clause right to ensure that the record copied from tableA only appears in table B once... ...

MySql Insert doesn't work when the website deployed on the host!

I'm using XAPP under windows and my website just working well! when I deployed it on the host server, it seems to be working normally, but the insert requests to MySql doesn't have any effect, nothing is changing on the database! Does anyone had this issue before? is there any configuration in MySql to make it accept insert requests? o...

Odd Mysql issue on insert.

Hy all, Not sure what's going on here, but if I run this: $query = 'INSERT INTO users (`id`, `first_name`, `second_name`, `register_date`, `lastlogin_date`) VALUES ("'. $user_id . '", "' . $first_name .'", "'. $second_name . '", "' . $date . '", "' . $date . ");'; $result = mysql_query($query); I get no return, but if I change it...

How to insert dynamically through a variable in PL/SQL??

Lets create a table first create table test ( id number, name varchar2(20) ); Now during insert, i wanna hold the data into variable first & then dynamically pass the variable into the VALUES clause. declare v_data varchar2(50); begin v_data:='1,sunny'; execute immediate 'insert into test values(v_data)'; commit; end; But ...

Help to insert a new section in a TableView

Hi, Everyone keep writing about deleting a section. Well, I can't seem to get one added. Currently, I am trying like this (which fails with NSInternalInconsistencyException): UITableView *tv = (UITableView *) self.tableView; if ([tv numberOfSections] == 1) { [tv beginUpdates]; [tv insertSections:[NSIndexSet indexSetWithInde...

Adding a record to an access database, Where is the error in this code?

read a lot about DataAdapter, DataTable ,.. to reach to this code, in the Save Button: 'insert new row ds.Tables("Employees").Rows.Add(ENumTxt.Text, ENameTxt.Text, EPosTxt.Text, EAgeTxt.Text, ESalTxt.Text, EPhonTxt.Text, EAdrsTxt.Text) 'save changes ds.AcceptChanges() Try If ds.HasChanges Then Dim AffectedDS As DataSet = ds.Ge...

How to use the GetInsertCommand method?

i used the named method like this: ds.Tables("Employees").Rows.Add(ENumTxt.Text, ENameTxt.Text,PosTxt.Text,EAgeTxt.Text,_ ESalTxt.Text, EPhonTxt.Text, EAdrsTxt.Text) If ds.HasChanges Then Dim AffectedDS As DataSet = ds.GetChanges(DataRowState.Added) Dim ComBuilder As New OleDb.OleDbCommandBuilder(da) ...

Take advantage of multiple cores executing SQL statements

Hi I have a small application that reads XML files and inserts the information on a SQL DB. There are ~ 300 000 files to import, each one with ~ 1000 records. I started the application on 20% of the files and it has been running for 18 hours now, I hope I can improve this time for the rest of the files. I'm not using a multi-thread a...

SQL Unique Record not column?

Is there a way to insert into an SQL database where the whole record is unique? I know you can make primary keys and unique columns, but that is not what I want. What is the best way of doing this without overloading the database? I have seen a sort of subquery where you use "WHERE NOT EXISTS ()" I just want to know the most efficient ...

INSERT 6000 Rows - best practice

I have a PHP script that calls an API method that can easily return 6k+ results. I use PEAR DB_DataObject to write each row in a foreach loop to the DB. The above script is batch processing 20 users at a time - and although some will only have a few results from the API others will have more. Worst case is that all have 1000's of resul...

inserting records in a MySQL table depending on existing values in another table

Hi guys, I am using MySQL. I want to insert some records in a table provided that they do not exist in another table. So I want to perform something like this: INSERT INTO sales (name, id) SELECT name, id FROM sales_h WHERE name AND id NOT IN (SELECT name, id FROM T_sales); The problem is that MySQL does not allow this kind of synta...

How to insert only new records using Linq-to-SQL?

I have to insert some data periodically in my SQL Server database. But the feeds where I read the data repeats some data that was inserted before. When I use Linq-to-SQL to insert into the DB either some data is duplicated, or a primary key violation exception is raised, depending on the primary key. How to insert the data without dupli...

Asp.Net Adding Images to SQL Table...What am I doing wrong?

I have done this previously but in a different way. I am trying to get the code below to work. If I do not cast 'OriginalPhoto' or 'Thumbnail' an error occurs. Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query. I don't understand why it asking to cast. However if I do ...

Is there an Oracle SQL tool that builds insert statements from a result set?

Is there an Oracle SQL tool that builds insert statements from a result set? We are currently only allowed to use a tool called SQL Station. I'd like to either suggest a tool, like Rapid SQL or CrazySQuirrell, or build my own re-usable chunk of sql. ...

Can't perform Create, Update or Delete operations on Table because it has no primary key

Hello! I've been trying to insert row in the table having an identity column RequestID (which is primary key as well) HelpdeskLog logEntry = new HelpdeskLog { RequestBody = message.Body }; if (attachment != null) logEntry.Attachments = Helper.StreamToByteArray(attachment.ContentStream); Database.HelpdeskLogs.InsertO...

How to insert dates selected from drop downs into mySQL table using php?

When you have 5 dropdowns for date selection (Y, m,d, H,i) how do you insert the selected date and time into a single column of a mySQL table as a datetime using PHP5? I know they need to be combined in a string such as: $DateTime="$Year-$Month-$Day $Hour:$Minute:00"; and then maybe use strtotime: $Date=date('Y-m-d H:i:s', strtotime...

Add row to query result using select

Hey guys, is it possible to extend query results with literals like this? Select name from users union select name from ('JASON'); or Select age, name from users union select age, name from (25,'Betty'); so it returns all the names in the table plus 'JASON', or (25,'Betty'). Thanks! ...

LINQ to SQL - No Add method available

I have created a LINQ to SQL datacontext with a single datatable in it. I am trying to simply insert a new record into that table. The problem I am coming across is LINQ is not offering an Add method to pass in the new record to. I have seen countless examples where there is an Add method, but I can't seem to get it. Am I completely ...

Cannot insert string into MySQL text column

For some reason, my queries screw up when I write to a column of type "text". Here is an example: Describe messages; Format is: Field Type Null Key Default id int(11) NO PRI NULL auto_increment title varchar(255) YES NULL body text YES NULL to text YES NULL content_type varchar(255) YES NULL is_sms tinyint(1) YES ...