How to update all columns with INSERT … ON CONFLICT …?

The UPDATE syntax requires to explicitly name target columns. Possible reasons to avoid that: You have many columns and just want to shorten the syntax. You do not know column names except for the unique column(s). “All columns” has to mean “all columns of the target table” (or at least “leading columns of the table”) … Read more

SQL INSERT based on SELECT results

INSERT INTO table (field) SELECT ‘1stString.’ + cast(id as varchar(50)) + ‘.2ndString’ FROM table2 WHERE id = 10 Edit – response to comment: You’re on the right track, but you want to select your hard-coded strings from your table, like this: INSERT INTO table1 (field1, field2, field3) SELECT ‘1stVal’, ‘2ndVal’, ‘1stString.’ + cast(id as varchar(50)) … Read more

How to insert a picture into Excel at a specified cell position with VBA

Try this: With xlApp.ActiveSheet.Pictures.Insert(PicPath) With .ShapeRange .LockAspectRatio = msoTrue .Width = 75 .Height = 100 End With .Left = xlApp.ActiveSheet.Cells(i, 20).Left .Top = xlApp.ActiveSheet.Cells(i, 20).Top .Placement = 1 .PrintObject = True End With It’s better not to .select anything in Excel, it is usually never necessary and slows down your code.

sed insert line command OSX

You should put a newline directly after the \: sed ‘3i\ text to insert’ file This is actually the behaviour defined by the POSIX specification. The fact that GNU sed allows you to specify the text to be inserted on the same line is an extension. If for some reason you need to use double … Read more

Kotlin prepend element

I think the easiest would be to write: var list = listOf(2,3) println(list) // [2, 3] list = listOf(1) + list println(list) // [1, 2, 3] There is no specific tail implementation, but you can call .drop(1) to get the same. You can make this head\tail more generic by writing these extension properties: val <T> … Read more

Insert element in Python list after every nth element

I’ve got two one liners. Given: >>> letters = [‘a’,’b’,’c’,’d’,’e’,’f’,’g’,’h’,’i’,’j’] Use enumerate to get index, add ‘x’ every 3rd letter, eg: mod(n, 3) == 2, then concatenate into string and list() it. >>> list(”.join(l + ‘x’ * (n % 3 == 2) for n, l in enumerate(letters))) [‘a’, ‘b’, ‘c’, ‘x’, ‘d’, ‘e’, ‘f’, ‘x’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)