Can anyone please share the steps to hide the particular column from the table in SQL Server 2012 as I don't want to delete that column
By hide I mean that whenever I use the select query against that particular table it should never show me that column.
Is it possible? I need to make the column as hidden irrespective of any user login and whatever query i use
Based on the comment But the problem is whenever i open the table in sql i dont want to see that particular column
i assume that the question is:
The screenshot below shows all columns of the table Employee despite the fact that the login StackoverIntern
has no select rights to the columns SSN, Salary
In the Answerset, right-click the columns to hide and select Hide Columns. To show all columns, right-click in the Answerset and select Show All Columns.
To hide individual columns, open the table for which you are hiding a column, right-click the column, and click Hide from Client Tools. You can hide multiple columns at a time by holding down the Ctrl key or the Shift key.
When temporal table is created, we need to defined start and end date time columns which can be hidden - not visible in SELECT * or INSERT without columns .
Late post but I think its worth to share
Earlier to SQLSERVER-2016 there was no any option to hide few columns from table when selecting *
, however SQLSERVER-2016
come up with HIDDEN
keyword by which you can now set columns hidden from Select *
which you don't want to show and want only for some background process of your business logic.
The HIDDEN property is optional and will hide these columns from a standard SELECT statement for backward compatibility with our application and queries. You cannot apply the HIDDEN property to an existing column
.
you can alter existing table as well lets take an example of existing table
ALTER TABLE [dbo].[Account] ALTER COLUMN [StartDate] ADD HIDDEN;
ALTER TABLE [dbo].[Account] ALTER COLUMN [EndDate] ADD HIDDEN;
You can check this concept used more often in Temporal table
you can find more on this in below Temporal Table
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With