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 2000 Forums
 Transact-SQL (2000)
 SQL Query execution doubt

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2006-07-11 : 11:26:58
sreejith writes "I have 3 columns say a1,a2,a3.if I enter some strings on a1 and a2,then a3 should display the concatenated result of a1 and a2. I want a3 should be updated immediately after I enter values in a1 and a2 and press the down arrow key. I have to get the a3 column filled with out using the run button. Is there any solution?"

nr
SQLTeam MVY

12543 Posts

Posted - 2006-07-11 : 11:27:43
A trigger on the table?
A computed column?

==========================================
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.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-07-12 : 02:50:50
What is the need of having a3? In select statement simply concatenate them

Select a1,a2,(a1+a2) as a3 from yourTable

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

RyanRandall
Master Smack Fu Yak Hacker

1074 Posts

Posted - 2006-07-12 : 06:51:19
Here's how you can use a computed column, as nr suggested, but I agree with madhivanan - do this when you select the results.

declare @t table (a1 varchar(20), a2 varchar(20), a3 as a1 + a2)
insert @t (a1, a2) values ('hello ', 'world')

select * from @t

/*results
a1 a2 a3
-------------------- -------------------- ----------------------------------------
hello world hello world
*/


Ryan Randall
www.monsoonmalabar.com London-based IT consultancy

Solutions are easy. Understanding the problem, now, that's the hard part.
Go to Top of Page
   

- Advertisement -