473,789 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hiding secret columns from users

Hi,
On my SQL Server 2000, I have a table of data (tblAllData) containing a
number of columns, some of which are 'secret'.
I have to let some users access the database using ODBC from an Excel
sheet, and I would like that they do not know at all that the columns exist.
I tried creating a view for them (qryAllData) that only selects the
columns that should be visible, but when the creating the
ODBC-connection, both the query and the underlying table shows up.
If I select the table as datasource, the query-builder in excel shows a
list of all the columns, including the secret ones. If I try selecting
then, of course, an error occurs.

I would like either that the columns for the table don't show or that
the table does not show at all - and only reveals the existence of the
view to the odbc-client.
Is that possible?

Here's what I tried so far:

<pre>
USE DbAllData
sp_addlogin @loginame='ODBC Access', @passwd='ODBCAc cess', @defdb='DbAllDa ta'
sp_grantdbacces s 'ODBCAccess'
sp_addrolemembe r @rolename = db_denydatawrit er, @membername = ODBCAccess

REVOKE ALL FROM ODBCAccess
DENY SELECT ON dbo.syscolumns TO ODBCAccess
DENY SELECT ON dbo.syscomments TO ODBCAccess
DENY SELECT ON dbo.sysdepends TO ODBCAccess
DENY SELECT ON dbo.sysfilegrou ps TO ODBCAccess
DENY SELECT ON dbo.sysfiles TO ODBCAccess
DENY SELECT ON dbo.sysfiles1 TO ODBCAccess
DENY SELECT ON dbo.sysforeignk eys TO ODBCAccess
DENY SELECT ON dbo.sysfulltext catalogs TO ODBCAccess
DENY SELECT ON dbo.sysfulltext notify TO ODBCAccess
DENY SELECT ON dbo.sysindexes TO ODBCAccess
DENY SELECT ON dbo.sysindexkey s TO ODBCAccess
DENY SELECT ON dbo.sysmembers TO ODBCAccess
DENY SELECT ON dbo.sysobjects TO ODBCAccess
DENY SELECT ON dbo.syspermissi ons TO ODBCAccess
DENY SELECT ON dbo.sysproperti es TO ODBCAccess
DENY SELECT ON dbo.sysprotects TO ODBCAccess
DENY SELECT ON dbo.sysreferenc es TO ODBCAccess
DENY SELECT ON dbo.systypes TO ODBCAccess
DENY SELECT ON dbo.sysusers TO ODBCAccess
--allow selecting
GRANT SELECT (idx, col1, col2) ON tblAllData TO ODBCAccess
GRANT SELECT ON qryAllData TO ODBCAccess
</pre>

TIA,
M
Nov 23 '05 #1
5 7582
You can specify WITH VIEW_METADATA so that only meta-data exposed by the
view is visible:

CREATE VIEW MyView
WITH VIEW_METADATA AS
SELECT MyPublicData FROM MyTable

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Morten Mikkelsen" <mbmnewsreader_ @_mikkelsens.ne t> wrote in message
news:43******** *************** @dread15.news.t ele.dk...
Hi,
On my SQL Server 2000, I have a table of data (tblAllData) containing a
number of columns, some of which are 'secret'.
I have to let some users access the database using ODBC from an Excel
sheet, and I would like that they do not know at all that the columns
exist.
I tried creating a view for them (qryAllData) that only selects the
columns that should be visible, but when the creating the ODBC-connection,
both the query and the underlying table shows up.
If I select the table as datasource, the query-builder in excel shows a
list of all the columns, including the secret ones. If I try selecting
then, of course, an error occurs.

I would like either that the columns for the table don't show or that the
table does not show at all - and only reveals the existence of the view to
the odbc-client.
Is that possible?

Here's what I tried so far:

<pre>
USE DbAllData
sp_addlogin @loginame='ODBC Access', @passwd='ODBCAc cess',
@defdb='DbAllDa ta'
sp_grantdbacces s 'ODBCAccess'
sp_addrolemembe r @rolename = db_denydatawrit er, @membername = ODBCAccess

REVOKE ALL FROM ODBCAccess
DENY SELECT ON dbo.syscolumns TO ODBCAccess
DENY SELECT ON dbo.syscomments TO ODBCAccess
DENY SELECT ON dbo.sysdepends TO ODBCAccess
DENY SELECT ON dbo.sysfilegrou ps TO ODBCAccess
DENY SELECT ON dbo.sysfiles TO ODBCAccess
DENY SELECT ON dbo.sysfiles1 TO ODBCAccess
DENY SELECT ON dbo.sysforeignk eys TO ODBCAccess
DENY SELECT ON dbo.sysfulltext catalogs TO ODBCAccess
DENY SELECT ON dbo.sysfulltext notify TO ODBCAccess
DENY SELECT ON dbo.sysindexes TO ODBCAccess
DENY SELECT ON dbo.sysindexkey s TO ODBCAccess
DENY SELECT ON dbo.sysmembers TO ODBCAccess
DENY SELECT ON dbo.sysobjects TO ODBCAccess
DENY SELECT ON dbo.syspermissi ons TO ODBCAccess
DENY SELECT ON dbo.sysproperti es TO ODBCAccess
DENY SELECT ON dbo.sysprotects TO ODBCAccess
DENY SELECT ON dbo.sysreferenc es TO ODBCAccess
DENY SELECT ON dbo.systypes TO ODBCAccess
DENY SELECT ON dbo.sysusers TO ODBCAccess
--allow selecting
GRANT SELECT (idx, col1, col2) ON tblAllData TO ODBCAccess
GRANT SELECT ON qryAllData TO ODBCAccess
</pre>

TIA,
M

Nov 23 '05 #2
Dan Guzman wrote:
You can specify WITH VIEW_METADATA so that only meta-data exposed by the
view is visible:

CREATE VIEW MyView
WITH VIEW_METADATA AS
SELECT MyPublicData FROM MyTable

This is a bit better.
However, now, when using excel to extract the data, the query designer
shows both MyView and MyTable in the dropdown for selecting the source.
If I select the table as source, the secret columns still show up.
How do I remove the table from the list of selectable choices while
still allowing them to select the data from it through the view?

TIA,
/M

Nov 23 '05 #3
Does the user have permissions on the table? In that case, the table will
be visible in the list.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Morten Mikkelsen" <mbmnewsreader_ @_mikkelsens.ne t> wrote in message
news:43******** *************** @dread15.news.t ele.dk...
Dan Guzman wrote:
You can specify WITH VIEW_METADATA so that only meta-data exposed by the
view is visible:

CREATE VIEW MyView
WITH VIEW_METADATA AS
SELECT MyPublicData FROM MyTable

This is a bit better.
However, now, when using excel to extract the data, the query designer
shows both MyView and MyTable in the dropdown for selecting the source.
If I select the table as source, the secret columns still show up.
How do I remove the table from the list of selectable choices while still
allowing them to select the data from it through the view?

TIA,
/M

Nov 23 '05 #4
Dan Guzman wrote:
Does the user have permissions on the table? In that case, the table will
be visible in the list.


The user has to have select permissions on the table for the view to
work, right?
/M
Nov 23 '05 #5
> The user has to have select permissions on the table for the view to work,
right?
No. Permissions on indirectly referenced objects are not checked as long as
the ownership chain is unbroken. The ownership chain is unbroken as long as
the objects involved are owned by the same user. This allows you to limit
user access to views and stored procedures while preventing direct access to
the underlying objects. Users only need permissions on those objects they
access directly. See the Books Online for more information on ownership
chains.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Morten Mikkelsen" <mbmnewsreader_ @_mikkelsens.ne t> wrote in message
news:43******** *************** @dread15.news.t ele.dk... Dan Guzman wrote:
Does the user have permissions on the table? In that case, the table
will be visible in the list.


The user has to have select permissions on the table for the view to work,
right?
/M

Nov 23 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
2090
by: Picho | last post by:
Hi all, Lets say I have a "secret" I wish to "hide", lets say a database password. For the more detailed problem, a web application/service that uses a connection string. all the solutions I came up with (embedding in code, encrypting-decrypting) involve embedding the/another secret in the code. since my problem cannot request a user intervention, I am at a stop.
6
3213
by: Marcus | last post by:
Is there a way to hide columns in a query? If so, where would I find some sample code on this topic? If this can be done, is it better to hide columns in a query, or simply build a second query with only those columns I require? Marcus ******
2
2131
by: Kevin | last post by:
Hi Al Can someone tell me how to hide colums in a datagrid. I have a one datagrid that is a master and child and I would like to hide specific columns, how do I do this TI Kevin
2
2631
by: MrNobody | last post by:
I found some tutorial which had the following example for hiding columns in a DataGrid: http://samples.gotdotnet.com/quickstart/util/srcview.aspx?path=/quickstart/aspplus/samples/webforms/ctrlref/webctrl/datagrid/datagrid7.src&file=CS\datagrid7.aspx&font=3 The problem is, I have no "Columns" property on my DataGrid! I'm using Visual C# .NET IDE, which has version 1.1 of the framework. Do I need a more advanced version of the framework?
1
840
by: Amber | last post by:
The DataGrid allows you to make columns visible or invisible on demand - even edit and other special columns. This article will show you how it is done. Some developers have reported problems controlling the visibility of columns in the DataGrid control. The problem usually comes down to one fact. The DataGrid has a property called AutoGenerateColumns. The default value is "True". This means that when AutoGenerateColumns is set to True,...
2
2912
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
Based on wether a row is selected in a GridView I need to HIDE the last two columns of a gridview. I do NOT need to make the cells invisible I want to hide the entire column. When I set the Visible property on the columns it causes the underlying ObjectDataSource to re-issue the Select statement. How can I hide these columns without double clutching the ODS Select?
9
2898
by: RobertTheProgrammer | last post by:
Hi all, Hopefully this one is rather simple. I just haven't been able to figure it out. On my GridView I have some hidden key columns which I've hidden by using tha attribute Visible="false" in the TemplateField declaration. This column is later used as an UpdateParameter field. Now if I leave the field as Visible="true", everything works fine and down in my C# code, I can easily access the UpdateParameter field with...
162
10303
by: Sh4wn | last post by:
Hi, first, python is one of my fav languages, and i'll definitely keep developing with it. But, there's 1 one thing what I -really- miss: data hiding. I know member vars are private when you prefix them with 2 underscores, but I hate prefixing my vars, I'd rather add a keyword before it. Python advertises himself as a full OOP language, but why does it miss one of the basic principles of OOP? Will it ever be added to python?
3
1808
by: troy_lee | last post by:
How do I suppress the properties box on database startup? Thanks.
0
9666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10412
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9986
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9021
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5422
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5551
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.