Viewing 15 posts - 2,446 through 2,460 (of 2,894 total)
I don't know which version of sqlserver you have. Try:
;with rn
as
(
select name, 2 grp, DENSE_RANK() OVER(ORDER BY name) rnk
...
August 5, 2010 at 2:35 am
Try this:
declare @test-2 table (Name varchar(30), userid char(50))
insert into @test-2
SELECT 'aaa', 'sjohn' UNION ALL
SELECT 'bbb', 'sjohn' UNION ALL
SELECT 'bbb', 'pkevin' UNION ALL
SELECT 'ccc', 'lsmith' UNION ALL
SELECT 'ccc', 'enobili' UNION ALL
SELECT...
August 4, 2010 at 9:59 am
Grant Fritchey (8/4/2010)
SUM(TotalMaterialValue) / SUM(TotalQuantityMade) AS AverageMaterialCost,
SUM(TotalLabourValue) / SUM(TotalQuantityMade) AS AverageLabourCost,
SUM(TotalOverheadValue) / SUM(TotalQuantityMade) AS AverageOverheadCost,
SUM(TotalTotalValue) / SUM(TotalQuantityMade) AS AverageTotalCost,
SUM(TotalTimeBookedMinutes) / SUM(TotalQuantityMade) AS AverageTimeInMinutes,
SUM(TotalTimeBookedHours) /...
August 4, 2010 at 9:03 am
This is duplicate post to one posted on T-SQL(SS2K8).
August 4, 2010 at 6:53 am
The behavior of your select statements using "not in" is well expected due to "undeterministic" nature of null value comparison.
That is why is not good idea to use it...
August 4, 2010 at 6:33 am
CELKO (8/3/2010)
...
I hope you know better than to...
August 4, 2010 at 6:21 am
Try:
declare @ReqDate datetime
set @ReqDate = '20100806' --GETDATE()
select LF-(7*wn)-(6) BeginDate, LF-(7*wn) EndDate, LF-(7*wn) PeriodEndingDate
from
(SELECT dateadd(dd, (DATEDIFF(dd,'1900-01-01',@ReqDate - 4) % 7 ) * -1, @ReqDate )...
August 4, 2010 at 6:06 am
Are you using SSIS? It can help you to filter the problem rows out.
August 4, 2010 at 3:49 am
No, actually BOL doesn't tell anything about it in the "SET NOCOUNT" article. However you can find the list of SET statements of the session scope:
August 4, 2010 at 3:45 am
No you don't need to.
Test this:
declare @sql nvarchar(1000)
set @sql = 'select count(*) from sys.objects'
exec sp_executesql @sql
and then this:
set nocount on
declare @sql nvarchar(1000)
set @sql = 'select count(*) from sys.objects'
exec sp_executesql @sql
Scope...
August 3, 2010 at 10:21 am
UnionAll (8/3/2010)
I am looking for a way to build a calendar table on the fly for the previous 3 weeks.
This calendar table will be like a table variable and this...
August 3, 2010 at 9:42 am
That whould work for maximum of 100 days period.
The maximum recursion of CTE...
You could extend it by specifying the MAXRECURSION hint, however you would still have a limit of approx...
August 3, 2010 at 9:22 am
Yep, OP's wording was clear enough for me... 😀
After looking closer into expected results I believe I do understand what he wants:
declare @beginDate datetime, @endDate datetime, @Org int
set...
August 3, 2010 at 8:34 am
with corrected setup...
-- setup
/*
CREATE TABLE #timekeep
(
ID VARCHAR(10),
Org VARCHAR(4),
)
CREATE TABLE #timecard
(
Date DATETIME,
ID VARCHAR(10),
Hours DECIMAL(10,2)
)
INSERT INTO #timekeep
(ID,Org)
SELECT '040677', '100' UNION ALL
SELECT '056789', '100' UNION ALL
SELECT '006777', '200'
INSERT INTO #timecard
(Date,ID,Hours)
SELECT...
August 3, 2010 at 6:41 am
If you still loking for solution, posting table DDL and insert script for some test data would help...
August 3, 2010 at 3:40 am
Viewing 15 posts - 2,446 through 2,460 (of 2,894 total)