MySQL table names into stored procedures and functions


2011-01-17 Digg! icurtain Delcious icurtain
As an aid memoir; Firstly, to create stored procedures in MySQL you need to temporarily change the line delimiter so you can add code with normal delimiters without delimiting what you're currently doing.  Secondly, in order to use variables passed into a procedure you need to concatenate into a...

MySQL full indexed text search - just like a real database!!


2009-03-24 Digg! icurtain Delcious icurtain
As of My Sql 3.something you can now add text indexes to your columns and do full text searches with relevance ranking! text indexes are fantastic and allow more efficient searching and categorisation of text. The relevance ranking feature is rather good too and gives you a much better idea of how y...

sql


2008-12-08 Digg! icurtain Delcious icurtain
sql    SERVEROUTPUT ON    declare     result_limit number := 10;     current_query_no number := 1;     --table_n varchar2(30) := 'brian.cran1400_der_results';     --cursor all_results is select * from brian.cran1400_der_results;     cursor result_list(counter number) is select * from brian....

sql server - set db offline


2008-05-30 Digg! icurtain Delcious icurtain
if you can't track down all the life connections and you need to force changes: use master alter database db_name set offline with rollback immediate...

SQL - Composite Primary Keys


2008-03-19 Digg! icurtain Delcious icurtain
http://weblogs.sqlteam.com/jeffs/archive/2007/08/23/composite_primary_keys.aspx...

Useful Regex for CSV to SQL


2008-03-07 Digg! icurtain Delcious icurtain
As a point of reference how to convert a comma delimited file to an SQL insert Assuming your data is the following 'key','value','0' 'key','value','1' In notepad++ the syntax for search and replace would be as follows: search: ('[^']+','[^']+','[^']+') replace: (\1) syntax varies d...

Mulitple OR conditions in SQL


2008-02-26 Digg! icurtain Delcious icurtain
based on ORDER_TRANSACTION __________ 1|ORDER__| 2|CREDIT__| 3|REFUND_| 4|PAYMENT| Instead of the following: SELECT ot FROM OrderTransaction AS ot WHERE ot.transactionType.transactionTypeDesc = 'Credit' OR ot.transactionType.transactionTypeDesc = 'Refund' OR ot.transac...

EJB QL Query Example


2008-01-16 Digg! icurtain Delcious icurtain
         SELECT              SUM(p.orderTransaction.transAmount)           FROM                  Payment AS p      ...

MYSQL UNION SELECT NULL


2007-08-27 Digg! icurtain Delcious icurtain
SELECT * FROM   crh_houses   LEFT JOIN   crh_p_tags  ON   crh_houses.house_id = crh_p_tags.house_id  WHERE  crh_houses.house_id = 3   UNION DISTINCT  SELECT   *,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL  FROM   crh_p_tags WHERE crh_p_tag...

MySql code - left join group by


2007-08-06 Digg! icurtain Delcious icurtain
SELECT   *  FROM   holiday_dates   LEFT JOIN    holiday_rentals   ON   holiday_rentals.week = holiday_dates.week    AND holiday_rentals.house_id = 3    GROUP BY holiday_dates.week...