Viewing 15 posts - 316 through 330 (of 1,438 total)
INSERT INTO table2(frmdt,todt)
SELECT ca.frmdt,ca.todt
FROM table1 t
CROSS APPLY(SELECT FDT1, TODT1
UNION ALL
...
July 15, 2013 at 2:17 am
WITH CTE AS (
SELECT Pk_Id,Lnno,Amount,Flag,
ROW_NUMBER() OVER(PARTITION BY Lnno ORDER BY Amount DESC) AS rn
FROM #Temp)
UPDATE CTE
SET Flag='Y'
WHERE rn=1;
July 10, 2013 at 7:31 am
Strange, but there seems to be a number of old threads being answered
http://www.sqlservercentral.com/Forums/Topic950491-145-1.aspx
http://www.sqlservercentral.com/Forums/Topic334022-149-1.aspx
http://www.sqlservercentral.com/Forums/Topic512190-338-1.aspx
July 9, 2013 at 7:30 am
WITH CTE AS (
SELECT ID ,Name ,SAl,Rownum,
ROW_NUMBER() OVER(PARTITION BY ID ORDER BY Rownum DESC) AS rn
FROM #Abc)
SELECT ID ,Name ,SAl,Rownum
FROM CTE
WHERE rn=1
ORDER BY...
July 8, 2013 at 1:41 am
July 5, 2013 at 1:33 am
SELECT DocumentNo_,
MAX(CASE WHEN DimensionCode='DEPARTMENT' THEN DimensionValueCode END) AS DimensionValueCode_1,
MAX(CASE WHEN DimensionCode='TRADETYPE' THEN DimensionValueCode END) AS DimensionValueCode_2
FROM...
July 4, 2013 at 4:36 am
dwain.c (7/4/2013)
CREATE TABLE #TABLE1...
July 4, 2013 at 2:19 am
You haven't provided enough information to answer this fully, but see if this helps
DECLARE @t TABLE(ID INT, Item VARCHAR(10), ShipTo VARCHAR(10),FCST01 VARCHAR(10),FCST02 VARCHAR(10),FCST03 VARCHAR(10));
INSERT INTO @t(ID, Item, ShipTo, FCST01, FCST02,...
July 3, 2013 at 8:51 am
Try this
WITH CTE1 AS (
SELECT Filename,SuccessFailIndicator,checkdate,
ROW_NUMBER() OVER(PARTITION BY Filename ORDER BY checkdate DESC) AS rn
FROM TABLE2)
SELECT t1.jobname
FROM TABLE1 t1
LEFT OUTER JOIN CTE1 c...
July 2, 2013 at 9:16 am
If you're using SQL Server 2012 you can use OFFSET..FETCH NEXT
DECLARE @PageNumber INT;
SELECT *
FROM myTable
OFFSET (@PageNumber-1) * 10000 ROWS
FETCH NEXT 10000 ROWS ONLY;
July 1, 2013 at 6:10 am
One possible solution, probably lots of others...
WITH Starts AS (
SELECT a.PatientID,a.AdmissionDate,
ROW_NUMBER() OVER(PARTITION BY a.PatientID ORDER BY a.AdmissionDate) AS rn
FROM TC79 a
WHERE NOT EXISTS(SELECT...
June 28, 2013 at 8:11 am
WITH CTE AS (
SELECT CustNo, ActivityStartDate, ActivityEndDate, DiffHours, ActivityEnd,
ROW_NUMBER() OVER(PARTITION BY CustNo ORDER BY ActivityStartDate) AS rn1,
...
June 28, 2013 at 3:26 am
SELECT @XML.value('(/CP/CustomProperty1/text())[1]','VARCHAR(20)')
June 28, 2013 at 2:06 am
Lowell (6/26/2013)
the...
June 26, 2013 at 9:53 am
As John suggested, note you'll need to use DATETIME rather than SMALLDATETIME
WITH CTE AS (
SELECT callref
, repid
, updatetime = CAST(updatetime AS DATETIME)
, rn =...
June 26, 2013 at 4:06 am
Viewing 15 posts - 316 through 330 (of 1,438 total)