insert

SQL datetime to string format

ぐ巨炮叔叔 提交于 2020-03-25 05:48:11
问题 I have some code which declares an object variable, and this variable is assigned a value from an existing database field. Dim datestart As Object datestart = dbToDate(dr("DateStart")) The variable is then passed through a function which checks whether or not it is null, and then converts it into datetime data type. Public Shared Function dbToDate(o As Object) As DateTime If o Is DBNull.Value Then Return Nothing Else Return Convert.ToDateTime(o) End If End Function The last thing I need to do

sql insert into table from select without duplicates (need more then a DISTINCT)

≡放荡痞女 提交于 2020-02-26 05:28:06
问题 I am selecting multiple rows and inserting them into another table. I want to make sure that it doesn't already exists in the table I am inserting multiple rows into. DISTINCT works when there are duplicate rows in the select, but not when comparing it to the data already in the table your inserting into. If I Selected one row at a time I could do a IF EXIST but since its multiple rows (sometimes 10+) it doesn't seem like I can do that. 回答1: INSERT INTO target_table (col1, col2, col3) SELECT

MySQL INSERT with lookup when null

北慕城南 提交于 2020-02-25 13:32:03
问题 I have the following query that works when the Lookup table has something in it. However if "z.a" doesn't equal anything the INSERT fails. Why would this be? INSERT INTO dataTable( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p )SELECT '000003', COALESCE(z.Registration, 'REG6'), 'PFTEST', '1', '1', '37000.0', '148.0', '439.8', '1312475688', '0', '54', COALESCE(z.TypeCode, 'A555'), '', '1173', '0', 'nJ' FROM LookupTable z WHERE z.a = '000003' 回答1: The outer insert query will insert anything

MySQL INSERT with lookup when null

烂漫一生 提交于 2020-02-25 13:31:08
问题 I have the following query that works when the Lookup table has something in it. However if "z.a" doesn't equal anything the INSERT fails. Why would this be? INSERT INTO dataTable( a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p )SELECT '000003', COALESCE(z.Registration, 'REG6'), 'PFTEST', '1', '1', '37000.0', '148.0', '439.8', '1312475688', '0', '54', COALESCE(z.TypeCode, 'A555'), '', '1173', '0', 'nJ' FROM LookupTable z WHERE z.a = '000003' 回答1: The outer insert query will insert anything

Use batch script to insert a string at a particular line in XML

穿精又带淫゛_ 提交于 2020-02-25 06:40:08
问题 i am new to programming. Can some1 kindly teach me how to insert a new line in an XML file using batch script? Current file has first 2 lines: <?xml version="1.0"?> <Workbook xmlns="urn:schemas-microsoft-com:xxxxxxxxx I want to add a format string on Line 2 so it has: <?xml version="1.0"?> <?mso-application progid="Excel.Sheet"?> <Workbook xmlns="urn:schemas-microsoft-com:xxxxxxxxxx It has to be using batch-file as the rest of the file is built with it. Cheers, Alan 回答1: @echo off setlocal

TreeMap - Search Time Complexity

↘锁芯ラ 提交于 2020-02-21 09:46:31
问题 What is the time complexity of a get() and put() in a TreeMap? Is the implementation same as a Red-Black Tree? 回答1: From here: http://java.sun.com/javase/6/docs/api/java/util/TreeMap.html This implementation provides guaranteed log(n) time cost for the containsKey, get, put and remove operations 回答2: TreeMap is: A Red-Black tree based NavigableMap implementation. This implementation provides guaranteed log(n) time cost for the containsKey, get, put and remove operations. Algorithms are

How to insertBefore() element in body tag?

余生长醉 提交于 2020-02-16 18:37:30
问题 I am trying to use insertBefore in js like this: var p = document.createElement("p"); p.innerHTML = "test1"; document.body.insertBefore(p, null); var p = document.createElement("p"); p.innerHTML = "test2"; document.body.insertBefore(p, null); But that would add the last p element just before the close of the body tag, how could I use it so it will be added to the top when it opens? So the last element added will be the first element inside the body tag. I tried: document.body.insertBefore(p,

Inserting Data into Hive Table

跟風遠走 提交于 2020-02-11 04:32:11
问题 I am new to hive. I have successfully setup a single node hadoop cluster for development purpose and on top of it, I have installed hive and pig. I created a dummy table in hive: create table foo (id int, name string); Now, I want to insert data into this table. Can I add data just like sql one record at a time? kindly help me with an analogous command to: insert into foo (id, name) VALUES (12,"xyz); Also, I have a csv file which contains data in the format: 1,name1 2,name2 .. .. .. 1000

SQL - ORA-00911 - Invalid Character while trying to insert records

十年热恋 提交于 2020-02-07 04:07:46
问题 Oracle Live SQL. I am trying to insert records for a table. The table goes through just fine but in each line of records, I am apparently entering some invalid characters. Of course, this is an extremely vague error. I don't know what's wrong. I've tried changing the date values, tried removing values individually, but no matter what I get the same error. CREATE TABLE Employee_Information ( employee varchar2(25) NOT NULL, Address varchar2(50) NOT NULL, Phone_number CHAR(10) NOT NULL, Hire

SQL - ORA-00911 - Invalid Character while trying to insert records

喜你入骨 提交于 2020-02-07 04:07:05
问题 Oracle Live SQL. I am trying to insert records for a table. The table goes through just fine but in each line of records, I am apparently entering some invalid characters. Of course, this is an extremely vague error. I don't know what's wrong. I've tried changing the date values, tried removing values individually, but no matter what I get the same error. CREATE TABLE Employee_Information ( employee varchar2(25) NOT NULL, Address varchar2(50) NOT NULL, Phone_number CHAR(10) NOT NULL, Hire