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 2005 Forums
 Transact-SQL (2005)
 Replace the field column name

Author  Topic 

knockyo
Yak Posting Veteran

83 Posts

Posted - 2007-06-03 : 14:05:27
Below is my TableA, but i dont want show the P001, P002, ...... for the my datagrid header



because i need to link below TableB,


so, finally my datagrid header, P001 with replace with Vlow, P002 --> VHigh........

is that possible?

pootle_flump

1064 Posts

Posted - 2007-06-03 : 16:35:45
quote:
Originally posted by knockyo

so, finally my datagrid header, P001 with replace with Vlow, P002 --> VHigh........


SELECT P001 AS Vlow, P002 AS VHigh
FROM MyTable
????
Go to Top of Page

knockyo
Yak Posting Veteran

83 Posts

Posted - 2007-06-04 : 00:51:56
Hi,

Thanks your reply.

At your statement, i notice that it is Hard Code at my program to generate the field name i want.

But in my situation, I need to use SQL or coding to link between above 2 tables TableA and TableB. This is because each of the data is different.
Eg:
(1) will happen P008, P009, P010........
(2) sometimes P001 will represent another value, Eg: "Contact"

So I cannot hard code it.

Thanks
Go to Top of Page

pbguy
Constraint Violating Yak Guru

319 Posts

Posted - 2007-06-04 : 01:13:53
Please do it in the front end which is better..

--------------------------------------------------
S.Ahamed
Go to Top of Page

knockyo
Yak Posting Veteran

83 Posts

Posted - 2007-06-04 : 02:04:15
Meaning that is?
Go to Top of Page

pbguy
Constraint Violating Yak Guru

319 Posts

Posted - 2007-06-04 : 02:14:02
I do not know what is your front end...take the column name of tableA(P001,P002..) in the front end and get the corresponding description of that column from the tableB and replace it.

--------------------------------------------------
S.Ahamed
Go to Top of Page

pootle_flump

1064 Posts

Posted - 2007-06-04 : 04:25:10
Just stepping back a pace or two - why name your fields P001 -> P007 in the first place? Why not name them as you want to display them in the first place?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2007-06-04 : 06:36:26
In addition to the above, you need either
http://www.datamodel.org/NormalizationRules.html
or
http://vyaskn.tripod.com/object_naming.htm


Madhivanan

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

- Advertisement -