SQL Query Where Field DOES NOT Contain $x

What kind of field is this? The IN operator cannot be used with a single field, but is meant to be used in subqueries or with predefined lists: If you are searching a string, go for the LIKE operator (but this will be slow): If you restrict it so that the string you are searching … Read more

Query comparing dates in SQL

Instead of ‘2013-04-12’ whose meaning depends on the local culture, use ‘20130412’ which is recognized as the culture invariant format. If you want to compare with December 4th, you should write ‘20131204’. If you want to compare with April 12th, you should write ‘20130412’. The article Write International Transact-SQL Statements from SQL Server’s documentation explains how to … Read more

ORA-12560: TNS:protocol adaptor error

o to the windows machine that hosts the Oracle database server Go to Start -> Run -> Services.msc in Windows. Locate OracleService < SID > (here OracleServiceORCL) and click on Start to start the oracle database service (if not already running) Once it is up and running, from the command prompt run the following:tnsping < tnsalias > (tnsalias entry you can … Read more

SQL Server FOR EACH Loop

SQL is primarily a set-orientated language – it’s generally a bad idea to use a loop in it. In this case, a similar result could be achieved using a recursive CTE:

How can I return pivot table output in MySQL?

This basically is a pivot table. A nice tutorial on how to achieve this can be found here: http://www.artfulsoftware.com/infotree/qrytip.php?id=78 I advise reading this post and adapt this solution to your needs. Update After the link above is currently not available any longer I feel obliged to provide some additional information for all of you searching for mysql pivot … Read more

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