Viewing 15 posts - 301 through 315 (of 532 total)
It would probably be better if you had a more real-word scenario (and please see the instructions in the link below) so we can understand what exactly you're trying to...
June 23, 2010 at 5:43 pm
I'll never again try to convince my company not to be stupid. Don't get me wrong, there are times when even intelligent managers just need a simple reminder and...
June 23, 2010 at 5:25 pm
declare @t_temp table (ID int, Value INT, Value2 VARCHAR(20))
insert into @t_temp
select 1, 5, 'Win32' union
select 2, 5, 'Win32' union
select 3, 7, 'Win32' union
select 4, 7, 'Win32' union
select 5, 7, 'Win32'...
June 21, 2010 at 4:12 pm
Eugene Elutin (6/18/2010)
I am assuming this query is run for reporting purposes, therefore dirty reads might be acceptable.
It depends on the reporting ... in many cases the fact that it...
June 18, 2010 at 1:35 pm
Add this above your code
declare @dt_today datetime,
@dt_theDateIWant datetime
select @dt_today = DATEADD(dd, DATEDIFF(dd,0,GETDATE()), 0)
select @dt_theDateIWant...
June 18, 2010 at 10:46 am
declare @t_temp table (ID int, Value int)
insert into @t_temp
select 1, 5 union
select 2, 5 union
select 3, 7 union
select 4, 7 union
select 5, 7 union
select 6, 7 union
select 7, 9 union
select...
June 18, 2010 at 10:26 am
declare @dt_today datetime,
@dt_theDateIWant datetime
select @dt_today = DATEADD(dd, DATEDIFF(dd,0,GETDATE()), 0)
select @dt_theDateIWant = case DATEPART(DW,@dt_today)
when 2 then DATEADD(dd, -3, @dt_today)
when 1 then DATEADD(dd, -2, @dt_today)
else DATEADD(dd, -1, @dt_today) end
select somedata
from sometable
where somedatefield...
June 18, 2010 at 10:17 am
If you are concerned about formatting output, you would be far better off handling all of that through whatever application you're using for the user interface. If you must...
June 17, 2010 at 11:13 am
Palanivelrajan (6/17/2010)
Dear Lawrence Moore,
ROFL
June 17, 2010 at 11:06 am
scott.pletcher (6/16/2010)
However, as you are working in a larger environment, the optimizer may even choose to use a non-covering index with less than fantastic selectivity just because the cost of...
June 16, 2010 at 1:35 pm
Lynn Pettis (6/11/2010)
Lynn Pettis (6/11/2010)
I know we have several MVP's here on SSC, but most of you don't advertise it, and perhaps...
June 15, 2010 at 6:15 pm
Very few non-competes hold up in court. Their usage has more to do with the psychological impact than the reality of their enforceability.
But yeah ... anything in a normal...
June 15, 2010 at 5:58 pm
Overall, for SQL to use any index, it has to highly selective or a covering index: I suspect that's unlikey here.
In a smaller environment you'll see the optimizer frequently...
June 15, 2010 at 5:49 pm
As ColdCoffee said, your SET_ANSI_NULLS setting will matter. This is one way to get your counts:
SET ANSI_NULLS ON
go
declare @t_temp table
(
ID int,
Column1 int,
Column2 int,
Column3 int,
Column4 int,
Column5 int
)
insert into @t_temp(ID, Column1,...
June 15, 2010 at 4:47 pm
IMO, best way to get a good SQL mentor is by way of a job at the right company. The challenge is finding that right company and then beating...
June 15, 2010 at 4:12 pm
Viewing 15 posts - 301 through 315 (of 532 total)