Viewing 15 posts - 6,001 through 6,015 (of 10,144 total)
harri.reddy (7/27/2012)
hii want next day function
for example. if i enter 12/31/2008 ,it should give me 01/01/2009
Check out DATEADD() in BOL.
July 27, 2012 at 9:00 am
You're welcome, thanks for the generous feedback 🙂
July 27, 2012 at 8:43 am
L' Eomot Inversé (7/26/2012)
ChrisM@Work (7/26/2012)
July 27, 2012 at 8:22 am
GigiMi (7/27/2012)
I need to put everything (values for next and previous) in only one row, if possible.Luigi
Ah I see, sorry my mistake. Try this:
SELECT l.ID, l.Dateref, n.ID, n.Dateref
FROM...
July 27, 2012 at 8:04 am
GigiMi (7/27/2012)
(more recent than any other record) I'd like to obtain something like this:
PreviousID - PreviousDateRef - NetxID - NextDateRef
25...
July 27, 2012 at 7:48 am
GigiMi (7/27/2012)
July 27, 2012 at 7:32 am
Here's a couple of ways:
DROP TABLE #Sample
CREATE TABLE #Sample (ID int, DateRef datetime, GroupID int)
INSERT INTO #Sample (ID, DateRef, GroupID)
SELECT 17, '2012-06-20 10:00:00.000', 463 UNION ALL
SELECT 21, '2012-06-22 12:00:00.000',...
July 27, 2012 at 7:21 am
Heya Pauliepoos, haven't seen you posting for ages!
SQL Kiwi (7/27/2012)
ChrisM@Work (7/27/2012)
July 27, 2012 at 6:57 am
You've probably cracked this now Anthony, with Lynn's code.
You could do this with a QU on the output but you'd have a new column with an incrementing string until...
July 27, 2012 at 6:17 am
Lynn Pettis (7/27/2012)
Oh, and the expected results based on the sample data.Thanks.
Lynn, just out of curiosity - because I don't know and "a developer should always know" - do you...
July 27, 2012 at 2:46 am
Jeff Moden (7/26/2012)
ChrisM@Work (7/26/2012)
WayneS (7/26/2012)
You'll might find this interesting: http://www.sqlperformance.com/2012/07/t-sql-queries/split-stringsVery interesting. Thanks, Wayne.
I know I enjoyed it. Gave me a chance to try out my new 4 band porkchop...
July 27, 2012 at 2:44 am
anthony.green (7/27/2012)
John's solution just run again took 8mins 8 secondsLynn's solution as used in a iTVF took 18 minutes 26 seconds.
How many rows are you working with? It would be...
July 27, 2012 at 2:11 am
WayneS (7/26/2012)
You'll might find this interesting: http://www.sqlperformance.com/2012/07/t-sql-queries/split-strings
Very interesting. Thanks, Wayne.
July 26, 2012 at 8:50 am
CROSSTAB and FOR XML PATH would be the most popular around here, there are loads of examples on ssc. FWIW there's a similar thread here.
July 26, 2012 at 8:29 am
L' Eomot Inversé (7/23/2012)
ChrisM@Work (7/23/2012)
SQLRNNR (7/23/2012)
C6H12O66-(hydroxymethyl)oxane-2,3,4,5-tetrol
Jason's C6H12O6 is a nasty ambiguous formula. ChrisW's thing is less ambiguous (but still ambiguous).
There's a nasty ambiguous word for it: hexose; but it's...
July 26, 2012 at 8:10 am
Viewing 15 posts - 6,001 through 6,015 (of 10,144 total)