Viewing 15 posts - 1,141 through 1,155 (of 2,171 total)
UPDATE Emp
SET Status = CASE WHEN Ename = REVERSE(Ename) THEN 'Palindrome' ELSE ' No palindrome' END
December 21, 2007 at 2:57 am
UPDATE Table1
SET Status = CASE WHEN Col1 = REVERSE(Col1) THEN 1 ELSE 0 END
December 21, 2007 at 2:56 am
AND ',' + @Line + ',' LIKE '%,' + DownlineLevel + ',%'
December 20, 2007 at 2:44 pm
-- Ok!
SELECTcb.batchid,
sl.SName,
sl.SType,
sl.SDepartment,
sl.OfficeHours,
sl.SNotes,
sl.SObjectives,
sl.SComments,
cl.cGraduatingYear,
cl.cOptionType,
cl.cDepartment1,
cl.cDepartment2,
cl.cStartDate,
cl.cEndDate,
cl.cObjectives,
cl.cNotes,
cl.cDiscipline1,
cl.courseDiscipline2,
cl.cDiscipline3,
cl.cDiscipline4,
cl.cDiscipline5
FROMSignList AS sl
LEFT JOINChurchList AS cl ON cl.ModuleID = sl.ModuleID
LEFT JOINChurchBatch AS cb ON cb.ModuleID = sl.ModuleID
WHEREsl.BatchID = '2333'
ORDER BYsl.BatchID
-- Not ok. ChurchList table is treated as INNER JOIN
SELECTcb.batchid,
sl.SName,
sl.SType,
sl.SDepartment,
sl.OfficeHours,
sl.SNotes,
sl.SObjectives,
sl.SComments,
cl.cGraduatingYear,
cl.cOptionType,
cl.cDepartment1,
cl.cDepartment2,
cl.cStartDate,
cl.cEndDate,
cl.cObjectives,
cl.cNotes,
cl.cDiscipline1,
cl.courseDiscipline2,
cl.cDiscipline3,
cl.cDiscipline4,
cl.cDiscipline5
FROMSignList...
December 19, 2007 at 1:06 pm
Yes.
It depends on the table alias for BATCH columns.
If the alias is one of the two LEFT JOINS, the LEFT JOIN is treated as an INNER JOIN instead.
December 19, 2007 at 1:02 pm
Either exclude it from the SELECT like this
SELECTSegmentID,
EXP(SUM(LOG(FirstYield / 100.0))) AS [Total Yield],
MIN(DayDate)
FROMtblBuildPlan
WHEREDayDate >= '2007-12-14'
AND DayDate < '2007-12-17'
AND FirstYield > 0
GROUP BYSegmentIDor change the value {NULL, 0} to 1,...
December 19, 2007 at 12:59 pm
DECLARE@Sample TABLE (SegmentID INT, TestType VARCHAR(30), FirstYield NUMERIC(12, 4), Hour INT, DayDate DATETIME)
SET DATEFORMAT MDY
INSERT@Sample
SELECT4, 'QA Inspection', 100.00, 12, '11/13/2007' UNION ALL
SELECT4, 'Test Station', 100.00, 12, '11/16/2007' UNION ALL
SELECT4, 'QA...
December 19, 2007 at 7:45 am
Use logarithms.
1*2*3*4*5*6 = 720
DECLARE@Sample TABLE (i INT)
INSERT@Sample
SELECT1 UNION ALL
SELECT2 UNION ALL
SELECT3 UNION ALL
SELECT4 UNION ALL
SELECT5 UNION ALL
SELECT6
SELECTEXP(SUM(LOG(i)))
FROM@Sample
December 19, 2007 at 7:25 am
The only thing missing is the table alias before the two references to BATCH column.
December 18, 2007 at 1:26 pm
-- Prepare sample data
DECLARE@Sample TABLE (Invoice CHAR(4), Account CHAR(4), Date DATETIME)
SET DATEFORMAT DMY
INSERT@Sample
SELECT'inv1', 'acc1', '10/12/2007' UNION ALL
SELECT'inv2', 'acc1', '11/12/2007' UNION ALL
SELECT'inv3', 'acc1', '12/12/2007' UNION ALL
SELECT'inv4', 'acc2', '11/12/2007' UNION ALL
SELECT'inv5', 'acc2',...
December 18, 2007 at 7:27 am
DECLARE@Sample TABLE (Invoice CHAR(4), Account CHAR(4), Date DATETIME)
SET DATEFORMAT DMY
INSERT@Sample
SELECT'inv1', 'acc1', '10/12/2007' UNION ALL
SELECT'inv2', 'acc1', '11/12/2007' UNION ALL
SELECT'inv3', 'acc1', '12/12/2007' UNION ALL
SELECT'inv4', 'acc2', '11/12/2007' UNION ALL
SELECT'inv5', 'acc2', '12/12/2007' UNION ALL
SELECT'inv6',...
December 18, 2007 at 6:45 am
When is the assignment due?
Don't worry. You will have a suggestion before that.
December 18, 2007 at 6:41 am
Also the SQL Server needs to create a query plan if it does not already exists in the query cache.
The second time you run the query, both plan and possible...
December 18, 2007 at 5:04 am
Why would you not like this output?
inv2 acc1 11/12/2007
inv3 acc1 12/12/2007
inv4 acc2 11/12/2007
inv5 acc2 12/12/2007
inv6 acc3 13/12/2007
December 18, 2007 at 4:51 am
Viewing 15 posts - 1,141 through 1,155 (of 2,171 total)