=DATE(LEFT(A1,4), 1, -2) - WEEKDAY(DATE(LEFT(A1,4), 1, 3)) + RIGHT(A1,2) * 7
Friday, January 27, 2017
Excel convert YYYYWW to date
=DATE(LEFT(A1,4), 1, -2) - WEEKDAY(DATE(LEFT(A1,4), 1, 3)) + RIGHT(A1,2) * 7
Sunday, January 8, 2017
Sunday, January 1, 2017
Converting SQL text columns from a single byte character codes to UTF8
use my_database;
-- preserve your old data in blob type
alter table my_tabe change my_column my_column blob;
-- set your default encoding to utf8
alter table my_table convert to character set utf8;
-- tell sql server your old code page ( i.e.: cp1256 )
alter table my_table change my_column my_column text charset {{code page}};
-- preserve your old data in blob type
alter table my_tabe change my_column my_column blob;
-- set your default encoding to utf8
alter table my_table convert to character set utf8;
-- tell sql server your old code page ( i.e.: cp1256 )
alter table my_table change my_column my_column text charset {{code page}};
Convert Non-UTF8 tables to UTF8 in sql database
-- convert old text columns to blob,
ALTER TABLE my_table CHANGE my_column_name my_column_name BLOB;
-- then update table character set
ALTER ignore TABLE my_table CONVERT TO CHARACTER SET utf8;
-- then convert the text columns back to text type
-- If your old scripts break, try explicitly setting the names to UTF8 before making sql queries
SET NAMES utf8;
SELECT my_column_name FROM my_table limit 10;
ALTER TABLE my_table CHANGE my_column_name my_column_name BLOB;
-- then update table character set
ALTER ignore TABLE my_table CONVERT TO CHARACTER SET utf8;
-- then convert the text columns back to text type
ALTER TABLE my_table CHANGE my_column_name my_column_name TEXT;
-- If your old scripts break, try explicitly setting the names to UTF8 before making sql queries
SET NAMES utf8;
SELECT my_column_name FROM my_table limit 10;
Subscribe to:
Posts (Atom)