insert

MySQL Insert Data Question

Hi, assume I already created a table in MySQL as below CREATE TABLE IF NOT EXISTS `sales` ( `id` smallint(5) unsigned NOT NULL auto_increment, `client_id` smallint(5) unsigned NOT NULL, `order_time` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, `sub_total` decimal(8,2) NOT NULL, `shipping_cost` deci...

Hibernate inserting into join table

I got several entities. Two of them got a many-to-many relation. When I do a bigger operation on these entities it fails with this exception: org.hibernate.exception.ConstraintViolationException: could not insert collection rows: I execute the operation i a @Transactional context. I don't do any explicit flushing i my daos. The flush ...

Adding Insert Row in tableView

Hello everyone, I have a tableView that loads its data directly from a Core Data table with a NSFetchedResultsController. I'm not using an intermediate NSMutableArray to store the objects from the fetch results; I basically implemented inside my UITableViewController the protocol method numberOfRowsInSection and it returns the numberOf...

Stored Procedure for Multi-Table Insert Error: Cannot Insert the Value Null into Column

Good Evening All, I've created the following stored procedure: CREATE PROCEDURE AddQuote -- Add the parameters for the stored procedure here AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; Declare @CompanyName nvarchar(50), @Addr nvarchar(50), @City nvar...

Insert into Table from #tempTable fails

I am simply taking the data from a Table and insert it into #tempTable then delete the data, and insert it back to the table. I get "Insert Error: Column name or number of supplied values does not match table definition." Error. Here are the lines I am running. SELECT * INTO #tempTable FROM dbo.ProductSales SELECT * FROM #tempTable ...

Insert Records in Radgrid using user control.

How can I insert in Radgrid using user control when I clock on the Add New Record. ...

Adding A New Row Using SQL Server Management Studio

I'm learning how to use SQL Server Management Studio and can't figure out how to insert a new row into a table. Table Structure: ID, Field1, Field2 Query: INSERT INTO Table (Field1,Field2) VALUES(1,2) Error: Major Error 0x80040E14, Minor Error 25503 I'm probably missing something very noobie like. Any help would be appreci...

Insert Data from to a table

I have a table that lists number of comments from a particular site like the following: Date Site Comments Total --------------------------------------------------------------- 2010-04-01 00:00:00.000 1 5 5 2010-04-01 00:00:00.000 2 8 ...

Is there a problem with this MySQL Query?

public function create() { echo $this->equipment->getCatId() . "<br/>"; echo $this->equipment->getName() . "<br/>"; echo $this->equipment->getYear() . "<br/>"; echo $this->equipment->getManufacturer() . "<br/>"; echo $this->equipment->getModel() . "<br/>"; echo $this->equipment->getPrice(...

Is there any way to simplify a verbose SQL INSERT INTO(..) query?

I have a table with one id (autonumber) field and 50 other fields. The table is normalized, these are 50 material properties etc. I want to copy a record from this table into the same table - only the autoincrement id will be different. The query I am using now is INSERT INTO tableName (field1,field2,....field50) SELECT field1,field2,...

Storing a jpa entity where only the timestamp changes results in updates rather than inserts (desired).

I have a JPA entity that stores a fk id, a boolean and a timestamp: @Entity public class ChannelInUse implements Serializable { @Id @GeneratedValue private Long id; @ManyToOne @JoinColumn(nullable = false) private Channel channel; private boolean inUse = false; @Temporal(TemporalType.TIMESTAMP) private Date inUseAt = n...

PHP | SQL syntax error when inserting array

Hi guys, I am having some trouble inserting an array into the sql database. my error is as follows: Unable to add : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '06:45:23,i want to leave a comment)' at line 1 My query var_dump is: string(136) ...

Insert Fails - Detailed Information

Hi, I am loading some data into a temp table. I then use a cursor to loop through the temp table, minipulate the data, and insert it into another table. The identity of the newly inserted record is then captured in a variable and inserted to another table to allow a look up of the newly inserted data. DECLARE c1 CURSOR READ_ONLY FO...

ASP.NET MVC Inserting object and related object into 2 tables

I have two tables: Users and UserOwners. Table UserOwners contains list of users that certain user created (list of child-users) - or to be more precise, it contains UserOwnerID and UserID fields. So, now I want to create a new user... in Controller I have something like this: var userOwner = accountRepository.GetUser(User.Identity.Nam...

Creating a MySQL trigger to verify data on another table

I am trying to set up a MySQL trigger that does the following: When someone inserts data into databaseA.bills, it verifies if databaseB.bills already has that row, if it doesn't, then it does an additional insert into databaseB.bills. Here is what I have: CREATE TRIGGER ins_bills AFTER INSERT ON databaseA.bills FOR EACH ROW BEGIN ...

Cakephp Insert Ignore Feature?

Is there a way to do an "insert ignore" in cake without using a model->query function? $this->Model->save(array( 'id' => NULL, 'guid' => $guid, 'name' => $name, )); Generates error: Warning (512): SQL Error: 1062: Duplicate entry 'GUID.....' for key 'unique_guid'...

Easy way to use Images in WPF

Hi All I've only just started using WPF. (I'm a WinForms guy), and from what I can see, trying to simply drag an image onto the Window is a huge PAIN. There seems to be no way where you can just select an option to tell it what picture to put indide the image control. I've seen so many sites within the last 10 minutes with atleast 10lin...

Output columns not in destination table?

SUMMARY: I need to use an OUTPUT clause on an INSERT statement to return columns which don't exist on the table into which I'm inserting. If I can avoid it, I don't want to add columns to the table to which I'm inserting. DETAILS: My FinishedDocument table has only one column. This is the table into which I'm inserting. FinishedDocum...

insert into database from Joomla form fields

Dear All, I am beginner to Joomla development, I have created a very simple module, How to create a form of three textfields in it, and then insert textfields data into database /. Any one can help ? ...

Can't save form content to database

I'm trying to save 100 characters form user in a 'microblog' minimal application. My code seems to not have any mystakes, but doesn't work. The mistake is in views.py, I can't save the foreign key to user table. models.py looks like this: class NewManager(models.Manager): def create_post(self, post, username): new = self.model(po...