Viewing 15 posts - 1 through 15 (of 20 total)
UPDATE [Table]
SET flag = 1
WHERE saNumber IN(SELECT saNumber FROM [Table] GROUP BY saNumber HAVING COUNT(*) > 1)
Dave
November 17, 2009 at 5:02 am
I Agree, I would firstly put the Max + 1 for each column into variables then use ROW_NUMBER() to assign the valid value.
Dave
September 15, 2009 at 3:01 pm
I think DENSE_RANK would be useful to you for your requirements, which will return records that have the same Salary, note I have also changed the order by to descending...
September 4, 2009 at 6:00 am
Same principal different code provided CONCAT_NULL_YIELDS_NULL is ON.
SELECT ISNULL('Last Upload: ' + CONVERT(VARCHAR, AuthorDate+'', 112), '')
FROM Documents
Dave
September 3, 2009 at 7:21 am
If i've understood your requirements correctly you might want to try DENSE_RANK()
SELECT
day_date,
year_num,
month_num,
DENSE_RANK() OVER(ORDER BY year_num, month_num)
FROM date_dim
WHERE day_date BETWEEN '2009-11-01' AND '2010-01-31'
Dave
September 1, 2009 at 1:15 pm
you could then use the SIGN() on the number of days, within a case statement. ie.
CASE SIGN([Statement])
WHEN -1 THEN 'Not till next year'
WHEN 0 THEN 'Happy Birthday'
ELSE CAST([Statement] AS VARCHAR)...
August 25, 2009 at 2:45 am
Once the data is in the table I would change the columns data type to decimal provided the data in the column is decimal format:
-- Check column in table contains...
August 21, 2009 at 7:09 am
The way I interpreted this thread was that what was needed was a count of new members that were not members the previous month. Have changed the MemberID's to smaller...
August 18, 2009 at 4:16 pm
SELECT TOP 1 WITH TIES Manufacturer, COUNT(*) FROM...
Dave
August 18, 2009 at 8:49 am
I don't understand why you are getting no results, the code below works for me...
IF OBJECT_ID(N'Table1', 'U') Is Not Null DROP TABLE Table1
IF OBJECT_ID(N'Table2', 'U') Is Not Null DROP TABLE...
August 12, 2009 at 4:37 am
Not 100% on this, but from what I understand (and after a few beers probably not alot!) this is what I've come up with...
SELECT
...
MaxFund.MaxDate
...
FROM dbo.Fund F
JOIN dbo.Fund_Valuation FV ON F.Fund_Number...
August 11, 2009 at 1:58 pm
This should work.. Spaces or not.
SELECT
SUBSTRING(LEFT(@A, 15), 0, LEN(LEFT(@A, 15)) - CHARINDEX(SPACE(1), REVERSE(LEFT(@A, 15))) + 1)
July 9, 2009 at 2:19 pm
I used to come across this problem, the company I work for use 08:00- 07:59, if you subtract 9 hours from the Date (I subtract 8) you will get the...
July 3, 2009 at 5:35 am
It's because the combination of fldCID and the ROW_NUMBER() are not distinct together, Try this...
SELECT fldCID, ROW_NUMBER() OVER(ORDER BY fldCID) FROM (SELECT DISTINCT fldCID FROM @test-2) AS X
June 24, 2009 at 4:57 am
Presuming I understand you correctly, you need to get 1000 rows at a time - Have you Tried ROW_NUMBER()? You need something to order by though, and change the Between...
June 22, 2009 at 8:32 am
Viewing 15 posts - 1 through 15 (of 20 total)