Re: Set a dinamic varable in query
- From: Hugo Kornelis <hugo@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 14 May 2005 01:25:24 +0200
On Fri, 13 May 2005 04:48:02 -0700, CJ wrote:
>Hello!
>I wish to use a variable i a query that can change under execute.
>
>Here are some of my rows, i wish to make the f3 colonne
>
>F1 F2 F3(my new colonne)
>10 text 10
>null text 10
>null tesxt 10
>11 text 11
>null tekxt 11
Hi CJ,
If these are all your columns, you are out of luck. A table in SQL
Server has no implicit ordering. As far as SQL Server is concerned, the
table above is exactly the same as this one:
F1 F2 F3(my new colonne)
null text 10
11 text 11
null tesxt 10
10 text 10
null tekxt 11
(Note that I merely has some of the rows switch position).
Your sample data indicates that you want to set F3 equal to F1 if it's
not NULL, or equal to F1 from the "last" of the "previous" rows with F1
not NULL otherwise. But since there is noting in the data to define
"last" or "previous", this becomes an impossible task.
If there is a way to distinguish "previous" and "last" rows from the
data, then feel free to repost. The best way to do that would be to
follow the guidelines in www.aspfaq.com/5006.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
.
- Follow-Ups:
- Re: Set a dinamic varable in query
- From: CJ
- Re: Set a dinamic varable in query
- References:
- Set a dinamic varable in query
- From: CJ
- Set a dinamic varable in query
- Prev by Date: RE: A tree of location and site names..
- Next by Date: Working With Binary Data Types
- Previous by thread: Set a dinamic varable in query
- Next by thread: Re: Set a dinamic varable in query
- Index(es):