Convert fields in SQL2005

alexe

New member
Joined
Sep 24, 2008
Messages
2
Programming Experience
Beginner
Hi.

I have two tables in sql2005

table1

id_item item_name
1 computer
2 pc
3 laptop

table2

EmployeeName id_item Telephone
Alex 1 03-123456


then i execute the sql querry in vb.net form

Strsql= "Select * from table2"

result of this query is
Alex 1 03-123456

my question : how to "convert" the id_item from table2 to item_name from table1, i order to show the result :

Alex computer 03-123456

Is it possible to do this without relationship on the tables ?

thanks
 
VB.NET:
[COLOR="Blue"]Select [/COLOR]EmployeeName, item_name, telephone
[COLOR="blue"]From [/COLOR]Table1
[COLOR="blue"]Inner Join[/COLOR] Table2 [COLOR="blue"]On [/COLOR]Table1.id_Item = Table2.id_Item
 
ok. is it possible to do it on 2 different databases?

Hi .Thank you for reply .

is it possible to do it on 2 different databases?

the first table on database db1 , and table 2 on database db2 ?

thanks
 
Yes, prefix each table name with DataBaseName.dbo. (DataBase1.dbo.Table1, DataBase2.dbo.Table2)

If the databases reside on different servers you must also prefix the database name with the server name. (Server1.DataBase1.dbo.Table1)
 

Latest posts

Back
Top