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)
 combine colums when retrieving the rows...

Author  Topic 

ugpjava
Starting Member

4 Posts

Posted - 2005-09-07 : 05:14:00
combine colums when retrieving the rows...
i.e: To get something like this...
A101
A102
A103
...
..


i create a DB (autoTest) with 2-columns (Symbol & Value)
Value field use identity...

////
ResultSet r=s.executeQuery("select *from autoTest");

while(r.next()){
String symbol=r.getString(4);
String num=r.getString(2);


txt1.setText(?????); //here i need to set the output to a textfield.like A100

}

Kristen
Test

22859 Posts

Posted - 2005-09-07 : 07:02:43
SELECT Symbol + CAST(Value as varchar(20)) FROM autoTest

If either is NULL then the result for that row will be NULL

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-09-08 : 02:07:09
You can also do the same in your application using Str(or equivalent) function

txt1.setText(symbol+num)

or

txt1.setText(symbol+str(num))

Because you have assigned those two to string data types, you can combine them

Madhivanan

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

- Advertisement -