mysql: backup databases

Posted Leave a commentPosted in MySQL

Backups all databases mysqldump -u [user] -p[password] --all-databases > [filename].sql   specific databases mysqldump -u [user] -p[password] [database_name] > [filename].sql   specific database but omitting specific tables mysqldump -u [user] -p[password] [database_name] --ignore-table=db1.tbl1 --ignore-table=db2.tbl1 > [filename].sql   restore mysql -u […]

pgsql: create table inside database

Posted Leave a commentPosted in PostgreSQL

Example   CREATE TABLE c_ordernotes ( c_ordernotes_id numeric(10,0) CONSTRAINT firstkey PRIMARY KEY, ad_client_id numeric(10,0) NOT NULL, ad_org_id numeric(10,0) NOT NULL, isactive character(1), created timestamp DEFAULT current_timestamp, createdby numeric(10,0), updated timestamp DEFAULT current_timestamp, updatedby numeric(10,0), c_order_id numeric(10,0), line numeric(10,0), notes_name varchar(255), […]

pgsql: replace add break

Posted Leave a commentPosted in PostgreSQL

UPDATE m_product SET em_mg_longdescription = regexp_replace(em_mg_longdescription,'------------',chr(13)) WHERE em_mg_manufacturer = 1000637 AND value = 'IMI-YW356A01'     Some additional replace scripts   UPDATE m_product SET em_mg_longdescription = regexp_replace(em_mg_longdescription,'</li>',chr(10)) WHERE em_mg_manufacturer = 1000637   UPDATE m_product SET em_mg_longdescription = replace(em_mg_longdescription,'<li>','') WHERE em_mg_manufacturer […]