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 |
ganeshkumar08
Posting Yak Master
187 Posts |
Posted - 2009-05-26 : 08:48:49
|
Hi I have a doubt in displaying a unique number like Row_Number() in sql 2005 in Sql2000, how to get it.ThanksGaneshSolutions are easy. Understanding the problem, now, that's the hard part |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2009-05-26 : 09:04:23
|
Use the row_number() function?That's if you want to return it rather than add it to a table.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2009-05-26 : 09:07:16
|
ROW_UMBER() in 2005There is no direct equivalent in 2000 but there are ways to produce sequences or unique identifiers as an extra column to a result set.Your request is vague......Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
|
|
ganeshkumar08
Posting Yak Master
187 Posts |
Posted - 2009-05-26 : 09:13:45
|
I have one column as dateTime, i have to show it as unique value in milliseconds.Even the date may be same date, but it must be different in milliseconds.How to achieve it??Solutions are easy. Understanding the problem, now, that's the hard part |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2009-05-26 : 09:24:08
|
Are you using sqlServer 2005 or 2000?There's nothing guaranteeing a DATETIME column is unique.Does your table have a primary key as well? If so what is the datatype? (or is it a set of columns)Charlie===============================================================Msg 3903, Level 16, State 1, Line 1736The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2009-05-26 : 09:24:34
|
Sorry - didn't notice this was 2000.datetimes are only accurate to about 3 milliseconds.Do you mean you want to update the values in a table to be unique?Easiest is probably to add an identity to the table then have a calculated column as dateadd(ms, id, '19000101')Why would you want a unique datetime though? It's an odd datatype for a unique value.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-05-26 : 12:36:13
|
quote: Originally posted by ganeshkumar08 I have one column as dateTime, i have to show it as unique value in milliseconds.Even the date may be same date, but it must be different in milliseconds.How to achieve it??Solutions are easy. Understanding the problem, now, that's the hard part
why do you want to make date a unique value? can you specify purpose? |
|
|
|
|
|
|
|