Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Wednesday, June 22, 2011

Thursday, June 16, 2011

多db record 處理情況

今日試左兩個好多record 既database table,基本上一join 就會load 太長時間timeout
同埋用左好多以前無寫既野,好似
1. declare variable
2. temp table
@tmptable, @@tmptable, #tmptable 既分別

How to add sequence number within groups of repeating values

Read this:

Tuesday, July 20, 2010

sql 2000 problem

Warning: The table 'xxx' has been created but its maximum row size (8707) exceeds the maximum number of bytes per row (8060). INSERT or UPDATE of a row in this table will fail if the resulting row length exceeds 8060 bytes.

Thursday, March 25, 2010

Oracle Special Table - Dual

Oracle:

Dual is a special table with a garbage cell which is used for our queries.

For example,
select seq.nextval from dual

Monday, September 14, 2009

Select 30% of records randomly in SQL Server

select top 30 percent * from [table_name] ORDER BY NEWID()

select 30% of records of last month

select top 30 percent * from[table_name]
and DatePart(""m"", date_created) = DatePart(""m"", DateAdd(""m"", -1, getdate()))
AND DatePart(""yyyy"", date_created) = DatePart(""yyyy"", DateAdd(""m"", -1, getdate()))
ORDER BY NEWID()

Tuesday, July 21, 2009

TSQL Union and Union ALL

Union will select distinct values where Union ALL will not