insert

Deleting Duplicates in MySQL

Query was this: CREATE TABLE `query` ( `id` int(11) NOT NULL auto_increment, `searchquery` varchar(255) NOT NULL default '', `datetime` int(11) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM first I want to drop the table with: ALTER TABLE `querynew` DROP `id` and then delete the double entries.. I tried it with: INSERT...

How to have a where clause on an insert or an update in Linq to Sql?

I am trying to convert the following stored proc to a LinqToSql call (this is a simplified version of the SQL): INSERT INTO [MyTable] ([Name], [Value]) SELECT @name, @value WHERE NOT EXISTS(SELECT [Value] FROM [MyTable] WHERE [Value] = @value) The DB does not have a constraint on the field that is getting checked for so in ...

Codeigniter/mySQL question. Checking if several inserts are possible before actual insertion.

Hey SO, So I'm trying to perform a couple inserts at once that are kind of co-dependent on each other. Let's say I'm doing a dog rating website. Anyone can add a dog to my database, but in doing so they also need to add a preliminary rating of the dog. Other people can then rate the dog afterwards. The dogs to ratings is a many to o...

jquery add row on click only if it's empty?

The code below works, insomuch that if I click in an input field, it'll add another row. I'm trying to figure out though, how to do that only if the input field is empty? $("#tableSearchData > tbody > tr > td > input").bind('focus', function(){ var row = $(this).closest("tr").get(0); if( row.className....

How can I concisely copy multiple SQL rows, with minor modifications?

I'm copying a subset of some data, so that the copy will be independently modifiable in future. One of my SQL statements looks something like this (I've changed table and column names): INSERT Product( ProductRangeID, Name, Weight, Price, Color, And, So, On ) SELECT @newrangeid AS ProductRangeID, Name, Weight, Price, Color, And...

PHP mysqli Insert not working, but not giving any errors.

As the title says Im trying to do a simple insert, but nothing actually is inserted into the table. I try to print out errors, but nothing is reported. My users table has many more fields than these 4, but they should all default. $query = 'INSERT INTO users (username, password, level, name) VALUES (?, ?, ?, ?)'; if($stmt = $db -> prep...

how to use insert command in sql analysis services

Hi all, I have a problem regarding how to use insert command in ssas, i try to send a request to server, server give a response saying "No binding exists for it", my request envelope is:- <Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/"&gt; <Body> <Execute xmlns="urn:schemas-microsoft-com:xml-analysis"> ...

Escaping single quote in PHP when inserting into MySQL

I have a perplexing issue that I can't seem to comprehend... I'm hoping someone here might be able to point me in the right direction... I have two SQL statements: - the first enters information from a form into the database. - the second takes data from the database entered above, sends an email and then logs the details of the transac...

Oracle PL/SQL: how can I use INSERT INTO but select data from different tables?

Here's what I want to do: Insert some data being passed into a procedure into a new table, but also include some data from another table too. Example: INSERT INTO my_new_table(name, age, whatever) VALUES (names.name, ages.age, passed_in_data); But that won't work. I did check another question on here, but it was a bit much for my fe...

PHP/MySQL - updateing 2 tables in one request

Morning, I want to learn more about sql and I'm wanting to update to tables; $query3 = "INSERT INTO `$table1`, `$table2` ($table1.DISPLAY_NAME, $table1.EMAIL_ACCOUNT, $table2.DISPLAY_NAME, $table2.EMAIL_ACCOUNT) values ('" . DISPLAY_NAME . "', '" . EMAIL_ADDRESS . "', '" . $get['rn'] . "', '" . $email . "')"; could some one point me i...

SQL IF ELSE with output params stored proc help

Hi All, I have a stored proc (SS2008) that takes a couple int ids and needs to look up if they exist in a table before adding a record. I have an int output param I would like to return and set its value based on what occrured. I have this so far, but it always returns 1. Can someone point me in the right direction? BEGIN TRY IF EXIS...

Dynamic Data custom page Insert to parent/child clears our parent but not child listviews

I'm new to Dynamic Data applications so please forgive me if this isn't clear. I have a custom page for an insert of a parent row. On that page at the bottom is a TabContainer with multiple tabs each with a ListView of a child table. When I click to insert a row for the parent, it clears out the parent properly but in the TabContainer ...

MySQL problem with Insert Clause

Hi! I've spent hours on this problem and for the life of me I can't figure it out, I have an Insert MYSQL command that is not executing, I've tried manually running the query on phpMyadmin and it actually does work but for some reason when the site runs the command, nothing is entered into the database. I have $sql = "INSERT INTO before...

Is there a better way to retrieve unique ID upon INSERT?

Hi, I am using the following SQL Server statement to insert records and return the unique auto-inc ID value all in one shot. Wonder if there is a simpler/faster/better way to do it? SET NOCOUNT ON; DECLARE @res table (ID bigint); INSERT INTO [Titles] ([Name],[Timestamp],[Title]) OUTPUT INSERTED.ID INTO @res VALUES ('Name','23 aug 2010...

Java, LinkedList of Strings. Insert in alphabetical order

I have a simple linked list. The node contains a string (value) and an int (count). In the linkedlist when I insert I need to insert the new Node in alphabetical order. If there is a node with the same value in the list, then I simply increment the count of the node. I think I got my method really screwed up. public void addToList(No...

How to skip all the column names in MySQL when the table has auto increment primary key?

A table is: mysql> desc gifts; +---------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------+-------------+------+-----+---------+----------------+ | giftID | int(11) | NO | PRI | NULL | auto_increment | | name | v...

Insert value in SQL database

In SQL Server 2005, I'm trying to figure out How to fill up the following fields? Any kind of help will be highly appreciated.. INSERT INTO [Fisharoo].[dbo].[Accounts] ([FirstName] ,[LastName] ,[Email] ,[EmailVerified] ,[Zip] ,[Username] ,[Password] ,[BirthDate] ,[CreateDate...

How to insert object already existing objects in NSMutableArray list.

I am getting a problem, while inserting an object into the main List. [editContactList addObject:editcontacts]; [editObject.contactList insertObject:editContactList atIndex:0];//error as mutating method sent to immutable object [editcontacts release]; ...

MySql insert data in multiple table at a time

hi, i have a query regarding to insert data in multiple table.. i have a two tables. one is item table and second is field table. itemid from item table reference in the field table. i want to insert data in both table with one query at a time. any idea about it. ...

Inserting data using Linq

I have a linq query to insert data in table. but its not working. I saw some example on internet tried to do like that but doesn't seems to work. Tablename: login has 3 columns userid, username and password. I set userid as autoincrementing in database. So I have to insert only username and password everytime.Here's my code. linq_testD...