Viewing 15 posts - 586 through 600 (of 1,923 total)
gksharmaajmer (11/9/2011)
Kindly let me know how do i1.Code the stored procedure
2.pass the required variables for the SP
Buddy, this is called spoon feeding. The things u asked above are so...
November 9, 2011 at 12:25 am
How about this?
DECLARE @CurrentDate DATETIME
,@StartOfMonth DATETIME
,@EndofMonth...
November 8, 2011 at 11:09 pm
goofbauer (11/7/2011)
How's this:
SELECTB.[To] AS IdleFrom
, A.[From] AS IdleTo
FROM A
OUTER APPLY(
SELECTTOP 1 [To]
FROM
WHERE[To] < A.[From]
ORDER BY[To] DESC) B
WHEREB.[To] IS NOT NULL;
Wonderful idea; i always thot we could accomplish this via APPLY,...
November 7, 2011 at 9:19 pm
First lets set up the sample data ( remember, you chances of getting a lovely query will depend solely on how clear and elaborate your question is)
SET NOCOUNT ON;
BEGIN
IF...
November 7, 2011 at 9:16 pm
A series of 15 CASE statment will do. Or dymanic query is also a route u can take.
Example of CASE statement
select country,
...
November 7, 2011 at 10:58 am
Thanks for stopping by and posting this. This would we heart warming to everyone of the answerers in this forum.
November 6, 2011 at 7:55 pm
LIKE at times make the query SARGable but CHARINDEX. CHARINDEX might cut performance form the total query ( My personal tryst with CHARINDEX has always been dreary 🙁 ) May...
November 4, 2011 at 7:45 pm
Results from my laptop ( my laptop sucks 😀 )
(100 row(s) affected)
(1000000 row(s) affected)
========== BASELINE ==========
(2 row(s) affected)
SQL Server Execution Times:
CPU time = 110 ms, ...
November 4, 2011 at 7:42 pm
L' Eomot Inversé (11/3/2011)
Could use a...
November 3, 2011 at 8:56 pm
Even better solution
DECLARE @MaxIDoFMaxPrice INT
; WITH RowWithMaxValue AS
(
SELECT TOP 1 ID
FROM @Table
ORDER BY PRICE DESC
)
SELECT @MaxIDoFMaxPrice = ID FROM RowWithMaxValue
SELECT * FROM @Table
ORDER BY CASE WHEN ID = @MaxIDoFMaxPrice...
November 3, 2011 at 8:15 pm
How will this do?
DECLARE @Table TABLE
( PRICE INT,
SOME_TEXT VARCHAR(15),
ID INT
)
INSERT INTO @Table
VALUES
( 11000 , 'AAAAAAAAA', 2 )
,(12000...
November 3, 2011 at 8:05 pm
So, the Group with the max price at the top with individual prices in the same group sorted by in desc order. what about the rest of the groups/rows? they...
November 3, 2011 at 7:50 pm
How about this?
SELECT A.[Account#] , A.RepCode [OldRepCode] , CrsAppOutput.RepCode [CurrentRepCode]
FROM #Account A
CROSS APPLY
( SELECT TOP 1 AD.RepCode
...
November 3, 2011 at 12:08 pm
Can you provide us sample of your data ( not your original data, but a mock-up)
November 3, 2011 at 11:43 am
Depends how do u define failure here... a failure is , say, datatype mismatch or failure to find a matching row ?
November 2, 2011 at 2:40 am
Viewing 15 posts - 586 through 600 (of 1,923 total)