Re: Sequential integer column in view

From: alien2_51 (dan.billow"at"n.o.s.p.a.m.monacocoach.commercialversion)
Date: 03/15/04


Date: Mon, 15 Mar 2004 08:32:07 -0800

Thanks Aaron...

"Aaron Bertrand [MVP]" <aaron@TRASHaspfaq.com> wrote in message
news:OvOMcE8BEHA.3024@tk2msftngp13.phx.gbl...
> Also see some examples here
> http://www.aspfaq.com/2427
>
> --
> Aaron Bertrand
> SQL Server MVP
> http://www.aspfaq.com/
>
>
> "alien2_51" <dan.billow"at"n.o.s.p.a.m.monacocoach.commercialversion>
wrote
> in message news:eZ6T6N7BEHA.2576@TK2MSFTNGP11.phx.gbl...
> > Duh.. Please excuse... CustomerID is an nchar... What would realoly help
> me
> > now would be an explanation as to how that works and under what
condition
> it
> > will work... Does it require you to compare on a unique column...?
> >
> > "alien2_51" <dan.billow"at"n.o.s.p.a.m.monacocoach.commercialversion>
> wrote
> > in message news:eLWHCM7BEHA.2060@TK2MSFTNGP12.phx.gbl...
> > > Hi Karl,
> > >
> > > Thanks for your reply... Thats a very interesting example... It does
> what
> > I
> > > had asked for... I'm not really sure what going on there but it seems
> that
> > > it requires an underlying identity column for the where clause (where
> > > c1.CustomerID >= c2.CustomerID).. Is that correct...? How would this
> work
> > > say if your table had a char as a primary key...?
> > >
> > > "Karl Gram" <NOSPAMkarl@gramonline.nl> wrote in message
> > > news:e%23qsQ%236BEHA.892@TK2MSFTNGP09.phx.gbl...
> > > > Hi,
> > > >
> > > > Here's a sample using the Nothwind Customers table:
> > > >
> > > > Use NorthWind
> > > >
> > > > select c1.CustomerID, (
> > > > select count(*) as rownum
> > > > from customers c2
> > > > where c1.CustomerID >= c2.CustomerID)
> > > > from customers c1
> > > >
> > > >
> > > >
> > > > --
> > > > HTH
> > > >
> > > > Karl Gram
> > > >
> > > > "alien2_51"
<dan.billow"at"n.o.s.p.a.m.monacocoach.commercialversion>
> > > wrote
> > > > in message news:u089Xz6BEHA.2804@tk2msftngp13.phx.gbl...
> > > > > I want to add a "Calculated" column to a view that basically auto
> > > > increments
> > > > > for every row returned from the view starting from 1 and
> incremetning
> > by
> > > > 1,
> > > > > does someone know if this can be done in a T-SQL statement... I
was
> > > > thinking
> > > > > of maybe cast something as an "int identity" but I'm not sure what
> to
> > > > > cast... I don't want to create a temp table or anything like
that...
> A
> > > > > sample would be AWESOME!! and very much appreciated...
> > > > >
> > > > > TIA....
> > > > >
> > > > > Dan
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>



Relevant Pages

  • Re: Find the first available integer.
    ... by being in simple recovery model). ... using a real server with a real disk system, and if you insert a reasonable ... Aaron Bertrand ... SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: datetime problem
    ... parameter statement. ... How many language tables do you have? ... >> Aaron Bertrand ... >> SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: back to referring page
    ... were a direct result of my fingers and brain not being synchronized or my ... "Aaron Bertrand - MVP" wrote in message ... > SQL Server MVP ... >> lack of caffeine. ...
    (microsoft.public.inetserver.asp.general)
  • Re: Trigger for tracking moddate & moduser
    ... update as many rows as were affected by the original statement. ... (SELECT primaryKey FROM Inserted) ... >> Aaron Bertrand ... >> SQL Server MVP ...
    (microsoft.public.sqlserver.programming)
  • Re: Timer function
    ... Can you show the EXACT error message you received (including the 0x800xxxxx ... >> Aaron Bertrand ... >> SQL Server MVP ... >>> I am having a problem calling the Timer function. ...
    (microsoft.public.inetserver.asp.general)