February 16, 2009 at 2:53 am
I have to create a table for a 3rd party to see. They will link to this table and insert data for their software. They can only see tables, otherwise I would have used a stored proc.
My issue is that I want to create the field names identical to the field names used in the 3rd party piece of software in order to make life easier for the User, but these field names aren't very descriptive. Is there a way I can create my fields with names I prefer and then show them to the User with different names (like alias)?
February 16, 2009 at 3:02 am
Use a view:
Example:
Table with your column names:
CREATE TABLE Orders (
ID int,
customerID char(100)
)
View with different column names:
CREATE VIEW LinkedOrders
AS
SELECT ID AS OrderNumber,
customerID AS customerNumber
FROM Orders
-- Gianluca Sartori
February 16, 2009 at 3:11 am
Thanks, but the 3rd party software can only see fields within tables.
February 16, 2009 at 3:14 am
Ok, so do the contrary: use a table for 3rd party sw, and a view for your querying.
-- Gianluca Sartori
February 16, 2009 at 3:21 am
I take it there is no way of aliasing fields in a table in this scenario without using a view etc.
February 16, 2009 at 3:27 am
You could also achieve it by creating a table for the 3rd party software and adding a trigger instead of insert/update that populates your table.
Of course it would work for writes only.
-- Gianluca Sartori
February 16, 2009 at 3:55 am
Is it possible to hide certain table field names? I don't want to show certain fields to the User, for eg. createdate etc.
February 16, 2009 at 6:11 am
You can deny privileges to the users on the columns you don't want them to see:
DENY SELECT ON OBJECT::dbo.myTable(columntToHide) TO [LowPermissionUser]
Obviously they won't be able to issue statements like SELECT * FROM myTable, but you could force them to select only the fields they will use.
Regards
Gianluca
-- Gianluca Sartori
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply