Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
craigmacca
Posting Yak Master
142 Posts |
Posted - 2010-02-23 : 08:05:20
|
| Hi i am using ROW_NUMBER() OVER but i have a problem which i am not sure what to do..currently i am using ROW_NUMBER() OVER(ORDER BY content_date DESC) AS rownum - the problem is some dates are the same so i get a error when it trys to insert into the temp table.what i would like to do is this if its possible...select content_date, content_titleROW_NUMBER() OVER(ORDER BY **current row count**) AS rownum INTO #tmp_tbl from contentorder by content_date desci am not sure how i would get a current row count but its the only way i can see it working, any ideas? |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2010-02-23 : 08:14:55
|
| what is the error you are getting?MadhivananFailing to plan is Planning to fail |
 |
|
|
craigmacca
Posting Yak Master
142 Posts |
Posted - 2010-02-23 : 08:20:47
|
| well a duplicate error, does ROW_NUMBER() need to be a unquie value??if i have 10 dates the same then this causes the issue |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-02-23 : 08:29:45
|
select ... into #tmp_tbl from ...cannot bring up a duplicate error.Please show us what you're really doing. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-02-23 : 10:18:18
|
quote: Originally posted by craigmacca well a duplicate error, does ROW_NUMBER() need to be a unquie value??if i have 10 dates the same then this causes the issue
duplicate error? are you using this query alone or is this part of a batch?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|