Hello all,
I am using SQL 2000 SP4. I was wondering if there was a way to assign a sql
result to a variable. The sql result I want to assign only returns one
number.
Any help is appreciated, thanks.> I am using SQL 2000 SP4. I was wondering if there was a way to assign a
> sql
> result to a variable. The sql result I want to assign only returns one
> number.
Without any detail, we can only guess. Perhaps:
declare @.test int
set @.test = (select max(column) from dbo.table)|||That works, thanks.
"Scott Morris" wrote:
> Without any detail, we can only guess. Perhaps:
> declare @.test int
> set @.test = (select max(column) from dbo.table)
>
>|||supersonic_oasis wrote:
> Hello all,
> I am using SQL 2000 SP4. I was wondering if there was a way to assign a s
ql
> result to a variable. The sql result I want to assign only returns one
> number.
> Any help is appreciated, thanks.
This might work:
DECLARE @.MyVariable INT
SELECT @.MyVariable = column FROM table WHERE condition is true
Showing posts with label var. Show all posts
Showing posts with label var. Show all posts
Thursday, March 8, 2012
assign sql result to a var?
Hello all,
I am using SQL 2000 SP4. I was wondering if there was a way to assign a sql
result to a variable. The sql result I want to assign only returns one
number.
Any help is appreciated, thanks.supersonic_oasis wrote:
> Hello all,
> I am using SQL 2000 SP4. I was wondering if there was a way to assign a sql
> result to a variable. The sql result I want to assign only returns one
> number.
> Any help is appreciated, thanks.
This might work:
DECLARE @.MyVariable INT
SELECT @.MyVariable = column FROM table WHERE condition is true|||> I am using SQL 2000 SP4. I was wondering if there was a way to assign a
> sql
> result to a variable. The sql result I want to assign only returns one
> number.
Without any detail, we can only guess. Perhaps:
declare @.test int
set @.test = (select max(column) from dbo.table)|||That works, thanks.
"Scott Morris" wrote:
> > I am using SQL 2000 SP4. I was wondering if there was a way to assign a
> > sql
> > result to a variable. The sql result I want to assign only returns one
> > number.
> Without any detail, we can only guess. Perhaps:
> declare @.test int
> set @.test = (select max(column) from dbo.table)
>
>
I am using SQL 2000 SP4. I was wondering if there was a way to assign a sql
result to a variable. The sql result I want to assign only returns one
number.
Any help is appreciated, thanks.supersonic_oasis wrote:
> Hello all,
> I am using SQL 2000 SP4. I was wondering if there was a way to assign a sql
> result to a variable. The sql result I want to assign only returns one
> number.
> Any help is appreciated, thanks.
This might work:
DECLARE @.MyVariable INT
SELECT @.MyVariable = column FROM table WHERE condition is true|||> I am using SQL 2000 SP4. I was wondering if there was a way to assign a
> sql
> result to a variable. The sql result I want to assign only returns one
> number.
Without any detail, we can only guess. Perhaps:
declare @.test int
set @.test = (select max(column) from dbo.table)|||That works, thanks.
"Scott Morris" wrote:
> > I am using SQL 2000 SP4. I was wondering if there was a way to assign a
> > sql
> > result to a variable. The sql result I want to assign only returns one
> > number.
> Without any detail, we can only guess. Perhaps:
> declare @.test int
> set @.test = (select max(column) from dbo.table)
>
>
Subscribe to:
Posts (Atom)