Viewing 15 posts - 256 through 270 (of 366 total)
Drop table test if it exist
Create table test
Create unique clustered index (id,colid,name)
June 8, 2005 at 4:25 pm
True Frank and I adjusted the code (including correcting the spelling errors) to yeild the results for the 5 min intervals and had intended to post both the corrected code...
June 7, 2005 at 1:30 pm
As usual Frank has the answer. I did not read the original post close enough. Parsing the input to the desired format ISO standard will solve the problem.
Mike
June 7, 2005 at 10:00 am
If you are parssing the 2 input paramaters as a string dmy there should be no problem. Or am I still missing something. Mike
Edited [if this does not work try an...
June 7, 2005 at 5:24 am
Hi SQL will handle the conversion for you. You can use either. between or <= and >=
HTH Mike
declare @StartDate datetime,
@EndDate datetime
set @StartDate = '01/02/2005'
set @EndDate = '01/31/2005'
Select * From temperatures
Where...
June 7, 2005 at 5:04 am
Cris have you tried switching the order of the statements when testing. i.e. test statement 2 then 1 then 3
Mike
June 6, 2005 at 6:17 pm
You can also use cast to convert from one data type to another.
HTH Mike
SELECT DATE_STAMP_ "DateTime", Cast(DATA_VALUE_ AS Decimal(19,4)) "Value"
FROM dbo.trenddata
WHERE TID_ = @TID AND @StartDate <= DATE_STAMP_ AND @EndDate >=...
June 6, 2005 at 3:32 pm
I am not sure what you need. Could you send the table def, some sample data and the expected results?
Mike
June 5, 2005 at 7:56 am
You can use one statement if I understand what you want.
SELECT something
FROM YourTable
WHERE FieldID = 2542
OR FieldID = 2541
OR..ect
AND eventID = 26
Selects all somethings with a fieldID of 2542 or...
June 5, 2005 at 6:40 am
I am a little confused. What is your primary key? Can you post a copy of your Table(s) definition and explain what you are trying to do.
The general form of...
June 5, 2005 at 5:49 am
Usage for the above sp
HTH Mike
Declare @TotalUsed varchar(50),
@s-2 decimal(19,4)
Create Table #Test
(
PeakValue Decimal(19,4),
FirstValue Decimal(19,4)
)
Execute @totalUsed = sp_TrendPeakTotalModified 11,'2003/5/1','2003/7/1',@S
Drop Table #Test
/*
SHOULD BE 299.36567
Returns 299.3657
*/
June 4, 2005 at 10:54 pm
Try this sp
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[sp_TrendPeakTotalModified]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[sp_TrendPeakTotalModified]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE PROCEDURE sp_TrendPeakTotalModified
-- declare the...
June 4, 2005 at 10:52 pm
Edited: Scrapped my previous post as it was returning incorrect data. Based on the following data (from K-Michael just cleaned up) the correct answer is 299.3657. My sp was returning...
June 4, 2005 at 6:34 pm
Sorry but I can not recreate your problem.
HTH Mike
CREATE TABLE #TEST
(
DT datetime default('2005/1/20'),
val int
)
insert into #Test(Val)Values(1)
insert into #Test Values(cast('1/21/99' as datetime),2)
select * from #Test
DROP TABLE #Test
/* returns
2005-01-20 00:00:00.000 1
1999-01-21 00:00:00.000 2
*/
June 4, 2005 at 7:53 am
Viewing 15 posts - 256 through 270 (of 366 total)