Viewing 15 posts - 1 through 15 (of 17 total)
and your question is?
Anju Renjith (3/23/2015)
I get the data from 3 different tables. I used case when to get the result as needed. It works fine...
March 24, 2015 at 5:22 am
As Chris in the above post suggested that you will get much quicker response if you supply with create table code too.
Here is the code, which I have done, as...
March 23, 2015 at 9:02 am
Just to let you know that the image is not showing here on the thread.
March 23, 2015 at 4:56 am
i am reading up on gaps and islands itzik ben gan too now..path to self eductaion or self destruction. 😛
TheSQLGuru (3/18/2015)
March 18, 2015 at 9:02 am
superb!!!Thanks a lot sir 🙂 🙂 🙂
Final code:
WITH cte AS
(
SELECTTestId,
TestDate,
--[GroupBy] = TestDate - rn,
RANK() OVER (
PARTITION BYTestId
ORDER BYTestDate - rn
)AS OrderId
FROM(
SELECTTestId,
TestDate,
ROW_NUMBER() OVER
(
PARTITION BY TestId
ORDER BY TestDate
)AS...
March 18, 2015 at 8:05 am
Output:
TestId TestDate rn ...
March 18, 2015 at 7:47 am
yup...it is showing up now
lesson learnt: "Patience is a virtue"
March 18, 2015 at 7:26 am
I managed to calculate difference between second and previous row:
SELECTTestId,
TestDate,
DIFF
FROM(
SELECTa.*,
b.TestDate AS PreviousRecordDate,
CASE WHEN DATEDIFF(DAY, b.TestDate, a.TestDate) <=1 THEN 0 ELSE 1 END AS DIFF
FROMdbo.tblDatesSequenceTest AS a
LEFT OUTER JOINdbo.tblDatesSequenceTest AS b
ONa.TestId=b.TestIdAND
a.TestDate=b.TestDate...
March 18, 2015 at 4:12 am
select * from mytable
where class='something'
and ISNULL(xyz, 99) = 1);
March 18, 2015 at 4:06 am
it can be sorted by keeping the required column in a view.
September 20, 2011 at 4:44 am
You could put all the sheet names in a system table and pick up all the names one by one from there, in a WHILE loop.
August 11, 2011 at 2:13 am
I have a very simple script which imports multiple excel files into a SQl table:
USE [Landcatch]
DECLARE @archivePath VARCHAR(500), @templateFolder VARCHAR(100), @cmd NVARCHAR(4000);
SELECT @archivePath = 'C:\', -- Excel file path comes...
October 20, 2009 at 9:34 am
The link: http://sqldigger.bdsweb.be to download the SQL Digger is not working, is there any other link where it can be downloaded from?
October 12, 2009 at 7:10 am
Hi Darren,
You might already have tried this but other way to tracking error is by doing:
PRINT @sDosCommand
before executing the command and see if there are any obvious typos or syntax...
August 11, 2009 at 8:27 am
Viewing 15 posts - 1 through 15 (of 17 total)