insert-into

$wpdb->insert produces “ Duplicate entry '0-0' for Key '1' ”

自闭症网瘾萝莉.ら 提交于 2019-12-25 08:18:37
问题 I'm writing a plugin and trying to insert a new row into the wp_term_relationships table inside of a foreach loop. I know the variables have values because of a var_dump, but for some reason, I'm getting an error consistently. This shows up about 600 times on the show_errors() function: WordPress database error: [Duplicate entry '0-0' for key 1] INSERT INTO wp_term_relationships ( object_id , term_taxonomy_id , term_order ) VALUES ('','','') My Code: foreach ($cb_t2c_cat_check as $values) {

Generate INSERT INTO statements in MS-Access

别来无恙 提交于 2019-12-25 08:02:23
问题 I like to export data (single records) from one Access database to another one in another country. The idea is that I want to send a text file with INSERT INTO statements per email and the receiving PC just executes these INSERT INTO statements. I wrote already the code to read and execute the INSERT INTO statements in these text files. Obviously I have to generate the INSERT INTO statements. Here is an example. I have the following table: Table1 Id number PersonName text DoB date, can be

Insert multiple columns and rows into SQL Server with node js

雨燕双飞 提交于 2019-12-24 17:54:59
问题 I'm trying to to make a script that reads from a nosql and inserts into a SQL Server database. That said I'm reading collections dynamically, so I need something to do things like var columns = [ 1, 2, 3, 4 ...] var values = [a, b, c ,4 ...] request.query("INSERT INTO TABLE (" + [columns] + ") VALUES ( " [values] ");" I have some collections with up to like 27 columns and I can't hog the database by inserting each value as I have like 20.000.000 registers to do... can't find anything that can

mysqli_multi_query fails on multiple inserts

别说谁变了你拦得住时间么 提交于 2019-12-24 12:15:10
问题 Greetings, I'm having the following issue: When I attempt to execute several INSERT INTO queries using the mysqli_multi_query function, none of them are executed and I receive a standard "You have an error in your SQL syntax" error, but when I take the exact same string I passed to the function and paste into PHPMyAdmin and execute it, it works flawlessly! Here are the queries I am attempting to execute: INSERT INTO production VALUES( 120, 103, 10, 0, 0 ); INSERT INTO production VALUES( 120,

Psycopg2 - How to include 'Null' values in inserting dictionary of list to table in postgres?

空扰寡人 提交于 2019-12-24 07:53:19
问题 I'm parsing my xml files and store them to a dictionary of list, where I will insert them into table at posgres using psycopg2. However, not all rows got inserted in the tables (it only inserted to the lowest number of values in the list). Here is the snippet of the dictionary of list: dict_songs = {'title' : ['Need You Now', 'GTFO'...], 'format': ['MP4', 'MP3'...], 'type' : ['Country Pop', 'R&B Pop'..], 'year': [2010,2018..]} dict_movie = {'title' : ['Searching', 'Sidewalk of New York'...],

MySQL How to assign a null value to non matching columns when using Group By

断了今生、忘了曾经 提交于 2019-12-24 05:27:10
问题 I have the following MovieTheaterTbl table: Name Location Date TicketRevenue SnackRevenue BeverageRevenue AMC Alpine St. 8/14 100 80 60 Atlas Main St. 8/19 300 150 100 Atlas Lincoln Rd. 8/19 50 50 40 I would like to insert this data into a table called SummaryTbl, which should display the sum of the Revenue columns, grouped by the movie theater name. If any of the other columns are not identical for rows with the same name (for example the location differs in the 2 Atlas entries), I would

Issues with getting uniqueidentifier auto generate in SQL on insert

自闭症网瘾萝莉.ら 提交于 2019-12-24 02:19:00
问题 I am trying to insert data from one table into another table. Table1 doesn't have a uniqueidentifier, but Table2 does. I have tried to insert using NEWID() , but I get a syntax error. Can someone please tell me what I am doing wrong? INSERT INTO Table2 (NEWID(), [Item Description], [Item Cost]) SELECT Description, Cost FROM Table1 WHERE Id = '1' 回答1: In case Table2 is not yet created you can use this query: SELECT NEWID() AS [ID] ,Description AS [Item Description] ,Cost AS [Item Cost] INTO

F# OleDb Syntax Error in INSERT INTO Statement Pulling Data from Access to Linked SQL Server

一个人想着一个人 提交于 2019-12-24 01:02:01
问题 I'm running an F# application to pull data from an Access table to a linked SQL Server table. Here is the resulting query: INSERT INTO dbo_TempTerm (UnitID, PolicyTermYear, InsuredName, PolicyNumber, RenewalDate, CovATotal, CovBTotal, CovLTotal, DwellExtn, AllOtherPerilDeductible, MedPay, TotalPremium, HurricaneDeductible, Zone, Subzone, PercentCRC, PercentCRD, YearBuilt, RenYrs, PercentCFD, PercentHA, PercentMLD, GRP1, PercentNH, QCLM, RateV, CRI, AgentCode, AgentName, AFOCode, PolicyType,

ado in excel, inserting records into access database

偶尔善良 提交于 2019-12-24 00:52:28
问题 First time asker, usually I can find the answer by searching, but my google-fu seems weak today. I have an excel workbook connecting to an access 2003 database to insert usage records The code i'm using is: sdbpath = ThisWorkbook.Path & "\Data.mdb" sCommand = "INSERT INTO Usage VALUES('" & Environ("Username") & "',#" & Now() & "#)" Dim dbCon As New ADODB.Connection Dim dbCommand As New ADODB.Command dbCon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sdbpath & "; Jet OLEDB:Database

Is there a way to run an insert into statement with a valid “?” in it?

試著忘記壹切 提交于 2019-12-24 00:26:10
问题 I am trying to build an insert into statement that will include a URL string which has a valid "?" in it. I am using Teradata SQL Assistant (Windows XP) and it is trying to translate this into a parameter. Is there any way to override this and treat it as a character value? Example URL: https://www.location.com/livelink.exe?func=ll 回答1: Go to the Query tab on the Tools -> Options... page and uncheck the box labeled "Allow use of Named Parameters in queries". Here are the settings I use: That