How do I escape a single quote in Presto?
The answer, provided by a_horse_with_no_name, is to use another ‘. ‘Driver”s License’
The answer, provided by a_horse_with_no_name, is to use another ‘. ‘Driver”s License’
http://dev.mysql.com/doc/refman/5.0/en/timestamp-initialization.html In addition, you can initialize or update any TIMESTAMP column to the current date and time by assigning it a NULL value, unless it has been defined with the NULL attribute to permit NULL values. In order to allow a TIMESTAMP to be nullable, create it using the NULL attribute, or alter the table … Read more
I think what you want to do is create a linked server as per this webarchive snapshot of msdn article from 2015 or this article from learn.microsoft.com. You would then select using a 4 part object name eg: Select * From ServerName.DbName.SchemaName.TableName
Update: This article in my blog summarizes both my answer and my comments to another answers, and shows actual execution plans: IN vs. JOIN vs. EXISTS SELECT * FROM a WHERE a.c IN (SELECT d FROM b) SELECT a.* FROM a JOIN b ON a.c = b.d These queries are not equivalent. They can yield … Read more
Nope, you’d need to run multiple statements. Because you need to delete from two tables, consider creating a temp table of the matching ids: SELECT U.Id INTO #RecordsToDelete FROM Users U JOIN LinkingTable J ON U.Id = J.U_Id … And then delete from each of the tables: DELETE FROM Users WHERE Id IN (SELECT Id … Read more
OUTER APPLY: SELECT Stuff.id ,Results.pn ,Results.s FROM stackoverflow_454945 AS Stuff OUTER APPLY dbo.Split(‘,’, Stuff.myColumn) AS Results WHERE ISNULL(Results.s,”) <> ”
From the fine manual: 36.1. Overview of Trigger Behavior […] For a row-level trigger, the input data also includes the NEW row for INSERT and UPDATE triggers, and/or the OLD row for UPDATE and DELETE triggers. Statement-level triggers do not currently have any way to examine the individual row(s) modified by the statement. And from … Read more
Like this: ;WITH cte AS ( SELECT ColumnB, SUM(ColumnA) asum FROM @t gROUP BY ColumnB ), cteRanked AS ( SELECT asum, ColumnB, ROW_NUMBER() OVER(ORDER BY ColumnB) rownum FROM cte ) SELECT (SELECT SUM(asum) FROM cteRanked c2 WHERE c2.rownum <= c1.rownum), ColumnB FROM cteRanked c1; This should give you: ColumnA ColumnB 3 a 6 b 10 … Read more
How about: UPDATE outgoing2.tbl_hochschule SET Quellendatum = ‘2012-06-20’ WHERE Quellendatum = ‘2005-06-20’ AND !isnull( Quellendatum );
You could use an outer join: select * from USER u left outer join EMPLOYEE e ON u.user_id = e.user_id left outer join STUDENT s ON u.user_id = s.user_id where s.user_id is not null or e.user_id is not null alternatively (if you’re not interested in the data from the EMPLOYEE or STUDENT table) select * … Read more