Redheadache
asked on
Function to Derive Field Names from Field Values - Sql Server
Hi all,
I've been trying to write a function to derive values from a table that I need to use for a sql server. The Parameter to pass in is a unique identifier - AttributeID and the field name will be AttributeName.
AttributeID AttributeName
AABA0A56-1736-4822-99BE-02 E33E1B1B57 Department
EB19A347-C50F-4440-BF3E-35 9FB5F95987 Address
BC1E774F-A36F-4FDD-BD1A-35 B398DF7142 Last Name
61D62DCA-C8B9-4B84-B3A4-37 560F8652F8 First Name
53372579-B97C-4901-9ED8-37 91B3DA05BF Date of Birth
Has anyone done something like this before? I'm not sure where to begin.
Thanks,
Julia
I've been trying to write a function to derive values from a table that I need to use for a sql server. The Parameter to pass in is a unique identifier - AttributeID and the field name will be AttributeName.
AttributeID AttributeName
AABA0A56-1736-4822-99BE-02
EB19A347-C50F-4440-BF3E-35
BC1E774F-A36F-4FDD-BD1A-35
61D62DCA-C8B9-4B84-B3A4-37
53372579-B97C-4901-9ED8-37
Has anyone done something like this before? I'm not sure where to begin.
Thanks,
Julia
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you want to supply an ID and return the name?
mmm, I smell a performance rat
Is there more than just that one table involved here? those sample records look to me like pointers to some non-normalized data in some other table(s).
Is there more than just that one table involved here? those sample records look to me like pointers to some non-normalized data in some other table(s).
ASKER
That's correct, supply an ID and return the name. Then I need to use the name returned as a field name in a select statement. I think I use brackets or something for that but I'll test it this morning to figure it out.
It is non-normalized raw data - that's correct. This is a thing that I will develop properly in the future but for now I just need something quick and dirty that I can reuse until I have time to get this data into a star schema and put together an analytic.
It's a start up company and there are five thousand different projects going on so every second I save is one I can spend sleeping.
I'll try the suggestion above. Thanks much for the quick responses.
J
It is non-normalized raw data - that's correct. This is a thing that I will develop properly in the future but for now I just need something quick and dirty that I can reuse until I have time to get this data into a star schema and put together an analytic.
It's a start up company and there are five thousand different projects going on so every second I save is one I can spend sleeping.
I'll try the suggestion above. Thanks much for the quick responses.
J