Viewing 15 posts - 1,141 through 1,155 (of 3,543 total)
WITH a (NMI,StartDate,ID,[Desc],EndDate,RowNum) AS (
SELECTNMI,StartDate,ID,[Desc],EndDate,ROW_NUMBER() OVER (ORDER BY NMI,StartDate) AS [RowNum]
FROMTempTest
)
SELECT a.NMI,a.StartDate,a.ID,a.[Desc],a.EndDate,a.RowNum,b.StartDate AS [NextStartDate],b.EndDate As [NextEndDate]
FROM a
LEFT JOIN a b ON b.NMI=a.NMI AND b.RowNum=a.RowNum+1
April 1, 2011 at 6:40 am
Can you post the data you used?
April 1, 2011 at 6:22 am
Craig Farrell (3/31/2011)[hrI like the glass idea. I wonder if that's feasible in price for a home office... hmmmmm....
Yeah and you could go outside and the solution would look...
March 31, 2011 at 6:05 pm
CirquedeSQLeil (3/31/2011)[hrHa - why stop there. I plan on working on SQL Server 2210 (you know when the file system be run by the DBMS).
Meh! By then it will...
March 31, 2011 at 6:01 pm
OK try replacing WHERE line with
WHERE timestampCompleted >= DATEADD(hour,6,DATEADD(minute,30,@startDate))
March 31, 2011 at 5:49 pm
Sorry error in Day calc
Try the posted code now.
March 31, 2011 at 10:08 am
Try replacing
CAST(timestampCompleted as TIME)
to
CONVERT(char(8),timestampCompleted,108)
March 31, 2011 at 9:42 am
Changed the code add FROM clause
March 31, 2011 at 9:33 am
pdonley (3/31/2011)
I'm getting a syntax error on that one inside the SUM() functions. THEN ELSE END...it says incorrect syntax near the keyword "ELSE"
Sorry my bad :blush:
Was in a hurry and...
March 31, 2011 at 9:27 am
DECLARE @startDate datetime;
SET @startDate = '2011-03-01 00:00:00.000';
DECLARE @endDate datetime;
SET @endDate = '2011-03-03 00:00:00.000';
SELECT [Day],
SUM(CASE WHEN [Type]='T' AND Shift=1 THEN 1 ELSE...
March 31, 2011 at 9:18 am
If I understand you correctly then you cannot have a single ID in your third table as a FK to two other tables (predios & fogos) unless the ID exists...
March 31, 2011 at 8:18 am
To do this you will have to use dynamic sql, ie
DECLARE @sql varchar(500)
SET @sql = 'select * from OPENQUERY(XHMNDGHFYUHFGHJFFRJF,''select {[Employee].[Dept].[Dept]*[Employee].[Empno].[Empno]} on 1,[Measures].[Salary] on 0 from [Employee] where [Employee].[Empname].&'+@name+''')'
EXEC (@sql)
March 31, 2011 at 6:43 am
The patindex is checking for two chars _ and space
charindex('_', @a) will return position of first _ char
patindex('%[ _]%', @a) will return position of EITHER _ or space
charindex('_', @a) and...
March 30, 2011 at 7:08 am
Depending on how and where the data is retrieved you could use sql CASE statement, ie
UPDATE ...
SET col15 = CASE
WHEN col2 >= 'V000' AND col2 < 'Y99 ' THEN col2
WHEN...
March 29, 2011 at 6:58 am
Viewing 15 posts - 1,141 through 1,155 (of 3,543 total)