Skip to content

Tag: sql

MySQL INSERT INTO … VALUES and SELECT

Is there a way to insert pre-set values and values I get from a select-query? For example: I have the value of “A string” and the number 5, but I’ve to find the [int] value from a select like this: that gives me that id to put inside table1. How to merge this into one statement? Answer Use a…

mysql change all values in a column

I want to change all values in the tablecolumn “Quellendatum”. When the row-value is 2005-06-20 then it should be replaced with 2012-06-20. When the row-value is NULL or empty, then it should be …

Pivot on Multiple Columns using Tablefunc

Has anyone used tablefunc to pivot on multiple variables as opposed to only using row name? The documentation notes: The “extra” columns are expected to be the same for all rows with the same row_name value. I’m not sure how to do this without combining the columns that I want to pivot on (w…

Using ISNULL when adding NULL to varchar

Whilst experimenting with MSSQL I came across some behaviour I cannot explain. I was looking at what happens to a NULL value when it is added to a varchar, and when I do the following query: I get the result ‘te’. Similarly if I change the word test for any other word I only get the first two lett…

How can I connect C# with Db with App.config?

I need to connect C# with SQL Server database using app.config. My code is: and in app.config I have: but I get an error and I can’t fix it: ConfigurationErrorExeption was Unhandled Configuration system failed to initialize Can anyone help me please ? Answer Try: You’re referencing Conn as the con…