Viewing 15 posts - 661 through 675 (of 1,439 total)
DECLARE @t TABLE(col1 VARCHAR(3), col2 DATETIME, col3 INT)
INSERT INTO @t(col1,col2,col3)
SELECT 'us', '01/01/2012', 10 UNION ALL
SELECT 'us', '02/02/2012', 11 UNION ALL
SELECT 'us', '03/03/2012', 33 UNION ALL
SELECT 'gbp', '01/01/2012',...
February 13, 2012 at 4:43 am
Here's another way using a hideous xquery
select
P.N.value('.', 'VARCHAR(40)' ) AS TYPEOFPHONE,
P.N.value('for $s in . return ../NUMBER[count(../TYPE[. << $s]) + 1][1]', 'VARCHAR(40)') AS NUMBER
FROM @xMLVAR.nodes('/RECORDS/RECORD') AS...
February 11, 2012 at 8:59 am
DECLARE @t TABLE(PNumber VARCHAR(2),ReasonCode VARCHAR(2))
INSERT INTO @t(PNumber,ReasonCode)
SELECT 'P1', 'E1' UNION ALL
SELECT 'P1', 'E1' UNION ALL
--SELECT 'P1', 'D1' UNION ALL
SELECT 'P1', 'D1' UNION ALL
SELECT 'P1', 'D1' UNION ALL
SELECT 'P2', 'E1' UNION...
February 10, 2012 at 9:09 am
See if this helps
SELECT Customer_Number,
SUM(Price) As TOTAL,
COUNT(CASE WHEN Product_ID IN...
February 9, 2012 at 6:49 am
John Mitchell-245523 (2/8/2012)
surely its down to the developer / administrator to realise that there is no guarantee what value will be used in the update.
Precisely. Would you use that...
February 8, 2012 at 8:45 am
SQL Kiwi (2/8/2012)
Mark-101232 (2/8/2012)
February 8, 2012 at 8:35 am
The non-deterministic behaviour of UPDATE..FROM is well known and fully documented in BOL. There are other non-deterministic functions in SQL Server such as the ANSI compliant ROW_NUMBER - would you...
February 8, 2012 at 8:16 am
February 8, 2012 at 5:31 am
WITH CTE AS (
SELECT part, stat, datevalue,
ROW_NUMBER() OVER(PARTITION BY part ORDER BY datevalue) AS rn
FROM dbo.test_table)
SELECT z.part,z.stat,z.datevalue,n.stat,n.datevalue
FROM CTE z
INNER JOIN CTE n ON...
February 8, 2012 at 1:53 am
mmiller 85218 (2/7/2012)
This works great, but is only accounting for those with FieldID =1. Would you just double the code and change your WHERE statement to FieldID = 2?
It's...
February 7, 2012 at 9:24 am
I think this gives you all of the combinations you're after, not sure how useful it would be as there's lots of them
WITH CTE(CatID,FieldID,Combinations,OptionsUsed) AS (
SELECT CatID,FieldID,CAST(FieldID AS VARCHAR(1000)),1
FROM #Cat
WHERE...
February 7, 2012 at 2:28 am
Use SUBSTRING
SELECT SUBSTRING(Address,1,25) AS AddressPart1,
SUBSTRING(Address,26,25) AS AddressPart2
FROM mytable
February 6, 2012 at 8:23 am
CoryJ72 (2/3/2012)
February 3, 2012 at 4:44 am
WITH CTE AS (
SELECT Product,Code,Description,Cost,
COUNT(*) OVER(PARTITION BY Product,Code) AS cn
FROM Table1
WHERE Description='X Large'
OR (Description='XX Large'...
February 3, 2012 at 3:30 am
Ignore ... misread OPs post
February 2, 2012 at 7:13 am
Viewing 15 posts - 661 through 675 (of 1,439 total)