score:0
In Oracle, this is done via the 'GRANT' command. I don't know is SQL Server has GRANT
GRANT is used:
GRANT [permissions] ON TABLE to [user]
so
GRANT select, insert, update, delete ON TABLE to User2
score:0
In SQL Server, there are Server Logins and Database users. Try associated the Server Login to the specific database by:
Database > Security > Users > New User...
score:1
The logins need to be associated with the databases by creating database users mapping to the logins.
score:3
You can setup a security role granting privleges on tables, views, and their access all of that. Associate the user desired to the role you have created and you will get the desired result.
The following should create a role, login, user and provide SELECT only permission to the view in question. The same methods can be applied for whatever permissions you wish.
CREATE ROLE [db_views_role] AUTHORIZATION [dbo]
GO
GRANT SELECT ON [dbo].[vMyView] TO [db_views_role]
GO
CREATE LOGIN [my_login] WITH PASSWORD=N'PASSWORD', DEFAULT_DATABASE=[MyDatabase], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
CREATE USER [my_login] FOR LOGIN [my_login]
GO
EXEC sp_addrolemember N'db_views_role', N'my_login'
GO
More questions
- SQL Server - Limit the databases view based on login
- SQL Server - Hide databases and limit user to see one View object only
- Changing the size of a column referenced by a schema-bound view in SQL Server
- SQL Server 2008 Windows Auth Login Error: The login is from an untrusted domain
- Is there a way to retrieve the view definition from a SQL Server using plain ADO?
- How do I view the full content of a text or varchar(MAX) column in SQL Server 2008 Management Studio?
- Cannot login after creating the user in SQL Server
- How to view the stored procedure code in SQL Server Management Studio
- How to view the roles and permissions granted to any database user in Azure SQL server instance?
- login failed for user 'sa'. The user is not associated with a trusted SQL Server connection. (Microsoft SQL Server, Error: 18452) in sql 2008
- How can I change the look of SQL Server Management Studio based on which database I'm connected to?
- What is the difference between login and credential in SQL server 2008?
- List all the databases on one SQL Server in the order they were created
- How to find the name of stored procedure, based on table name search, using SQL Server 2008?
- Practical limit for the number of databases in SQL Server?
- SQL Server 2008 - Login failed. The login is from an untrusted domain and cannot be used with Windows authentication
- What is the Equivalent syntax of mysql " LIMIT " clause in SQL Server
- The SQL Server instance returned an invalid or unsupported protocol version during login negotiation
- SQL Server -is a GUID based PK the best practice to support tenant based horizontal partitioning
- Hiding databases for a login on Microsoft Sql Server 2008R2 and above
- Is it possible to create a Unique ID in an SQL Server View that will remain the same each time the view is called?
- How I can view the deleted records from a sql server table?
- SQL Server : update rows based other rows in the same table
- What is the fastest way to delete all customers from SQL Server based on that customer not meeting a single criteria
- How do I view the definition for a stored procedure that cannot be modified in SQL Server 2008 R2?
- Can you change the column length in a view in SQL Server 2000?
- Is it possible to query the system databases in SQL server without using the names?
- where is the default location for all databases in sql server
- SQL Server - Simultaneous Inserts to the table from multiple clients - Check Limit and Block
- DSN tests ok, but login failure trying to use the DSN to SQL Server 2005
More questions with similar tag
- How find square brackets in SQL by LIKE expressions?
- Traditional SqlClient can find server instance but EF can't
- How to join id occurrences instead of simply showing count(*)?
- Storing Log4Net Messages in SQL Server
- "Invalid attempt to call Read when reader is closed" error (for lengthy operations only)
- How do I install a SQL Server on the hosted build agent in Visual Studio Online?
- Query for Finding Hyphen in Sql Server
- SQL Server 2008 Performance: No Indexes vs Bad Indexes?
- Joining/Merging records from two non related tables based on specific column
- SQL Pivoting from rows to columns leaves nothing but NULL values
- Trying to avoid multiple single field unique indexes
- Return id after insert C# using SQL Server
- SSMS add comma delimiter - shortcut
- Problems with Turkish SQL Collation (Turkish "I")
- dll MATLAB, dll DBMS, blob?
- CASE WHEN in Order By taking too much time
- SQL - One to Many join with left outer join
- SQL Table Valued Parameter - Default Value
- SQL Server - GO n times
- SQL Server Union of a single label header and a boat load of data columns
- Cannot convert varchar to float
- SQL aggregate function query selecting multiple columns
- How to exclude rows from an aggregate based on the rest of the rows in the aggregate
- No SQL dependency telemetry after moving to Microsoft.Data.SqlClient
- Calculate time at specific Timezone, from UTC Time
- Sqlcmd connect using active mfa authentication
- SQL Server Constraints
- How to narrow down count query by a finite time frame?
- SQL Server DateDiff Vs .Net DateDiff
- SQL Timeout expired for 2 second query