2017年5月9日 星期二

sql #temptable

http://stackoverflow.com/questions/4391442/how-to-save-select-query-results-within-temporary-table

Look at SELECT INTO 

select *
into #TempTable
from SomeTale

select *
from #TempTable
SELECT ID as 'ID',
(SELECT <....> FROM table WHERE <...> ) AS 'Total No of people'
FROM somewhere

SELECT LTRIM(RTRIM(Names)) AS Names FROM Customer

SELECT CONVERT(varchar(10), field_name) FROM table_name
LEFT(colName, 1)


firstname lastname
Bill      smith
you can do something like
select firstname + ' ' + lastname from thetable
What I use for IsNotNullOrEmptyOrWhiteSpace in T-SQL is: link
SELECT [column_name] FROM [table_name]
WHERE LEN(RTRIM(ISNULL([column_name], ''))) > 0


Code
USE AdventureWorks2012;  
GO  
SELECT   ProductNumber, Category =  
      CASE ProductLine  
         WHEN 'R' THEN 'Road'  
         WHEN 'M' THEN 'Mountain'  
         WHEN 'T' THEN 'Touring'  
         WHEN 'S' THEN 'Other sale items'  
         ELSE 'Not for sale'  
      END,  
   Name  
FROM Production.Product  
ORDER BY ProductNumber;  
GO  



UPDATE
  MyTable
SET
  MyColumn = UPPER(MyColumn)


Finial save the result

LINK from stackoverflow
Use following syntax to create new table from old table in SQL server 2008 :
Select * into new_table  from  old_table 
Adding Column in existing Table:

ALTER TABLE Tb_Table1 ADD isdone  BIT DEFAULT 0
a BIT column can have two values (0 = false, 1 = true) or no value at all (NULL)


Better techniques for trimming leading zeros in SQL Server?
I've been using this for some time:

SUBSTRING(str_col, PATINDEX('%[^0]%', str_col), LEN(str_col))








2017年5月2日 星期二

System Scheduler and Refresh tray icons - How to remove dead tray icon after killing a program/process

http://techforpassion.blogspot.hk/2014/04/refresh-tray-icons-how-to-remove-dead-tray-icons-after-killing-program.html


The FREE version of System Scheduler is fully functioning with no embedded advertising or other software.
Bullet Download System Scheduler FREE Version  ·Install File (2.5M)·   
http://www.splinterware.com/download/ssfree.exe

Best way to remove leading zeros from a non-numeric value in Excel &Convert numbers stored as text to numbers


I have many cells in an Excel sheet, using 9 characters of 0-9 and A-Z, that have some number of prefixed zeros:
000000123 
000001DA2 
0000009Q5
0000L210A
0000014A0
0000A5500
00K002200
I'd like to remove the leading zeros so that the values become:
123 
1DA2 
9Q5
L210A
14A0
A5500
K002200

=SUBSTITUTE(TRIM(SUBSTITUTE(B2,"0"," "))," ","0")
=IF(LEFT(A1) = "0" ,RIGHT(A1, LEN(A1)-1),A1)
Convert numbers stored as text to numbers

3. Click Data > Text to Columns

Data tab, Text to Columns button
On the Data tab, click Text to Columns.

4. Click Finish

Finish button
Click Finish right away and Excel will convert the cells.

2017年4月30日 星期日

酒莊全名Les Terres de Saint Hilaire(舊名:Abbaye Saint Hilaire )

http://abbayesthilaire.blogspot.hk/p/blog-page.html


地理位置:因酒莊位於整個南法的中央,以酒莊為中心,開車至附近大城鎮所花費的時間
西邊南邊東邊
Aix-en-provence 艾克斯35-45分Marseille 馬賽45-60分Cannes 坎城一個半小時
Avignon 亞維儂一個半小時Cassis卡西斯 45-60分Nice 尼斯二個小時左右

A 點為酒莊,
黃色標記為大城市 Avignon, Aix-en-Provence, Marseille, Nice

2017年4月29日 星期六

4k ssd aligment and 新買的SSD速度為什麼很慢?原因在這裏 re-alignment 4k

新買的SSD速度為什麼很慢?原因在這裏
http://www.diskgenius.cn


How to Speed Up Your Solid-State Drive by Re-Aligning Its Partitions


The fastest way we’ve found to do this is to use the free version of MiniTool Partition Wizard–you don’t need to pay for a premium version, the free version can do everything you need. Install it on Windows, launch the partition manager, right-click the partition you want to align, and select “Align”. It’ll do all the hard work for you.


When you’re done, you should hopefully find that you’re getting the best possible speeds out of that blazing fast SSD.

2017年4月28日 星期五

Batch: Copy a list (txt) of files , copy the files only on txt list

http://stackoverflow.com/questions/6257948/batch-copy-a-list-txt-of-files

@echo off
set src_folder=c:\whatever
set dst_folder=c:\target
for /f "tokens=*" %%i in (File-list.txt) DO (
xcopy /S/E "%src_folder%\%%i" "%dst_folder%"
)

2017年4月27日 星期四

Asus K455L boot USB when start

F2 to enter BIOS

Launch CMS -> enable
pxe -> enable or disable

add Boot Option #1 and #2 as USB

Security -> Security Boot -> Disable

F10 to Save and Quit

When booting ....

ESC long press to select boot Option
youtube video #1 Asus X555L Bios Boot from Usb / Disk Drive
youtube video #2 How to Boot Asus F550 Laptop From Bootable USB Drive to Install Windows 7/8/10