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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 create numerator

Author  Topic 

inbs
Aged Yak Warrior

860 Posts

Posted - 2011-06-27 : 01:09:14
hoew can i create numerator on view

i have view:

customerNO
customer
-->newId

123  'Custoemr1' 1
123 'Custoemr1' 2
123 'Custoemr1' 3


SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2011-06-27 : 02:07:20
SELECT CustomerNO, Customer, ROW_NUMBER() OVER (ORDER BY CustomerNo) AS [NewID]
FROM dbo.Table1



N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-27 : 02:50:36
How do you want the newId to go on if the customerNO is changing?


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

inbs
Aged Yak Warrior

860 Posts

Posted - 2011-06-27 : 04:02:26
i create the table every night in newly
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-27 : 04:26:28
That was not my question
quote:
Originally posted by inbs

hoew can i create numerator on view

i have view:

customerNO
customer
-->newId

123  'Custoemr1' 1
123 'Custoemr1' 2
123 'Custoemr1' 3
234 'Customer2' 4 or 1 again?







No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

williamku87
Starting Member

6 Posts

Posted - 2011-06-27 : 04:36:57
quote:
Originally posted by webfred

That was not my question
quote:
Originally posted by inbs

hoew can i create numerator on view

i have view:

customerNO
customer
-->newId

123  'Custoemr1' 1
123 'Custoemr1' 2
123 'Custoemr1' 3
234 'Customer2' 4 or 1 again?







No, you're never too old to Yak'n'Roll if you're too young to die.

it will start 4...

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-06-27 : 04:48:04
quote:
Originally posted by williamku87

quote:
Originally posted by webfred

That was not my question
quote:
Originally posted by inbs

hoew can i create numerator on view

i have view:

customerNO
customer
-->newId

123  'Custoemr1' 1
123 'Custoemr1' 2
123 'Custoemr1' 3
234 'Customer2' 4 or 1 again?







No, you're never too old to Yak'n'Roll if you're too young to die.

it will start 4...




Yes, I know it will with the given solution.
But my question is if it SHOULD...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -