Viewing 15 posts - 451 through 465 (of 2,007 total)
prathibha_aviator (10/15/2012)
I have tried using the below code
select...
October 15, 2012 at 9:15 am
Here's how you should lay out your sample data: -
CREATE TABLE Customer (CustomerID INT, CustomerName VARCHAR(200), Birthdate DATETIME);
INSERT INTO Customer
SELECT CustomerID,CustomerName,Birthdate
FROM (VALUES(1,'John Doe','1/1/1970 08:31 AM'),(2,'Jane Doe','1/1/1971 01:18 PM'),
...
October 15, 2012 at 8:52 am
Hello and welcome to SSC,
If you could knock up some sample data and DDL scripts, then your expected results based on the sample data provided that would be extremely useful...
October 15, 2012 at 6:14 am
ramyours2003 (10/15/2012)
How temp db worksin ? sql
October 15, 2012 at 5:55 am
Next record based on what? What is the ordering here?
Sample data: -
CREATE TABLE tmp_end_date(ID INT,tgs_rec_eff_dt DATETIME);
INSERT INTO tmp_end_date
SELECT ID, tgs_rec_eff_dt
FROM (VALUES(1300505,'2012-08-01 15:57:15'),(1300505,'2012-08-01 15:55:16'),
...
October 15, 2012 at 5:42 am
ChrisM@Work (10/12/2012)
ps Craig, if you're in the Hob at 6.15, I'll buy you a pint 😉
That the one on Broad Street? I'm in the process of moving house, we couldn't...
October 12, 2012 at 9:37 am
ChrisM@Work (10/12/2012)
I've just tried cheating by putting an ordinary index on startdate and the results are a little weird - possibly because my poor lappy is...
October 12, 2012 at 9:21 am
jon.wilson (10/12/2012)
Here's what I've been able to get so far. I can get the results by running one query...
October 12, 2012 at 8:48 am
Wow. As Sean said, this is pretty weird as is always going to be out of sync.
Because it's always going to be out of sync, you might as well do...
October 12, 2012 at 8:28 am
Lowell (10/12/2012)
WITH myCTE ([Branch],[Year],[Count of All who failed],[Count of all right handed who failed])
AS
(
SELECT 'Blue ',2012 , 120 , 87 UNION ALL
SELECT 'Red ' ,2011 ,...
October 12, 2012 at 8:17 am
Jeff Moden (10/12/2012)
Cadavre (10/12/2012)
If you insist on doing it in the database layer, it can be achieved like this:
Check again. OP's desired output doesn't actually have a comma as...
October 12, 2012 at 8:15 am
jon.wilson (10/12/2012)
October 12, 2012 at 8:02 am
Smash125 (10/12/2012)
YEAR(OrderDate) ASOrderYear,
SUM(CASE WHEN DATENAME(Q,OrderDate) =1 THEN TotalDue END)AS Q1,
SUM(CASE WHEN DATENAME(Q,OrderDate) =2 THEN TotalDue END)AS Q2,
SUM(CASE WHEN DATENAME(Q,OrderDate) =3 THEN TotalDue END)AS Q3,
SUM(CASE WHEN DATENAME(Q,OrderDate) =4 THEN TotalDue...
October 12, 2012 at 7:44 am
OK, I'm back in the office 🙂
IF object_id('tempdb..#mySchedules') IS NOT NULL
BEGIN
DROP TABLE #mySchedules;
END;
SELECT TOP 1000000
[id], DATEADD(DAY,((ABS(CHECKSUM(NEWID())) % 366) + 1),CAST('2010' AS DATE)) AS [recorddate],
'schedule'+CAST(a.id AS VARCHAR(7))...
October 12, 2012 at 7:35 am
I'm not back yet, but will be leaving soon as it looks like they're nearly finished so can test in 30 minutes or so. But could your code not be...
October 12, 2012 at 6:44 am
Viewing 15 posts - 451 through 465 (of 2,007 total)