Viewing 15 posts - 451 through 465 (of 3,011 total)
This code will work for any date within a quarter to find the end of month for the three months in the prior querter.
select
CurrDateTime,
PriorQtrMonth1 = dateadd(mm,(datediff(QQ,0,CurrDateTime)*3)-2,-1),
PriorQtrMonth2 = dateadd(mm,(datediff(QQ,0,CurrDateTime)*3)-1,-1),
PriorQtrMonth3 = dateadd(mm,(datediff(QQ,0,CurrDateTime)*3),-1)
from
(...
September 20, 2012 at 9:35 am
dwain.c (9/12/2012)
Michael Valentine Jones (9/12/2012)
dwain.c (9/12/2012)
;WITH MyValues AS (
SELECT Id
,A=CASE WHEN A > 0 THEN A...
September 12, 2012 at 9:20 pm
dwain.c (9/12/2012)
;WITH MyValues AS (
SELECT Id
,A=CASE WHEN A > 0 THEN A ELSE 2147483647 END
...
September 12, 2012 at 8:53 pm
I think this code is about as short as it gets to do this:
select
[DD-MM-YYYY] =
convert(varchar(10),dateadd(mm,(12*YEAR_)-22801+MONTH_,DAY_-1),105),
[Date]=dateadd(mm,(12*YEAR_)-22801+MONTH_,DAY_-1),
a.*
from
PS_TestForOnline a
Results:
DD-MM-YYYY Date ...
September 12, 2012 at 8:21 pm
This seems simple and fairly fast:
declare @n table ( n int not null primary key clustered)
insert into @n select top 1000 n=row_number() over(order by id)-1 from syscolumns
select*
from(selectx,y,z = x-y, c...
September 12, 2012 at 11:20 am
a_sql (9/12/2012)
I was asked to peel an Orange at one of my interviews..
The ancient Japanese art of Orange-gami:
http://www.youtube.com/watch?feature=player_embedded&v=CVHF0J8XOKM
September 12, 2012 at 8:55 am
select
ID,
[MinVal] = (
select
min(x)
from
(
select x=A where A > 0 union all
select x=B where B > 0 union all
select x=C where C > 0
) m
)
from
#MinAmt
order by
ID
Results:
ID ...
September 10, 2012 at 8:19 pm
dwilliscp (9/7/2012)
Michael Valentine Jones (9/7/2012)
You haven't provided enough information for anyone to begin to answer that question.You should just try each way to see which is faster.
The problem with...
September 7, 2012 at 1:20 pm
You haven't provided enough information for anyone to begin to answer that question.
You should just try each way to see which is faster.
September 7, 2012 at 8:11 am
ALIF-662928 (9/4/2012)
Yeah we tried to copy the files into 15 smaller files,
Did you compress the files?
What was the total size of the compressed backup files?
Did you copy multiple files in...
September 4, 2012 at 4:58 pm
If you are not using one, I suggest installing a backup compression product, like Litespeed or Redgate backup, to make the files smalller. Or as an alternative, use a...
September 4, 2012 at 2:52 pm
I think any conference situation where there is a lot of consumption of alcohol, especially by young men, is likely to lead to this sort of behavior.
This is probably why...
September 4, 2012 at 9:52 am
SQL Mad Rafi (8/31/2012)
My problem is: the DML of a table fails, then i found that it is because of a indexed view on...
August 31, 2012 at 12:26 pm
The thing I think is stupid about the EAV model is that it actually poorly duplicates what is already built into SQL Server: sys.tables, sys.columns, sys.types, and the tables themselves.
The...
August 31, 2012 at 9:58 am
sestell1 (8/31/2012)
guerillaunit (8/31/2012)
August 31, 2012 at 9:26 am
Viewing 15 posts - 451 through 465 (of 3,011 total)