'SQL Query Error - Error Source: .Net SqlClient Data Provider
Error Message: The SELECT permissions was denied on the object 'quote', database 'oneview', schema 'dbo'.
I am relatively new to SQL and the developer I am learning from is only part time and very hard to get a hold of unfortunately. Can anyone help me understand what is wrong with the Query below and suggest any fixes that might be needed?
SELECT licenseEntitlement.entID, licenseEntitlement.entStartDate, licenseEntitlement.entEndDate, quote.quoteId, quote.accountId, quote.clientId,
quote.clientName, quote.contactName, quote.contactEmail, quote.extReference, quote.purchaseOrderNumber, quote.linkedTicket
FROM licenseEntitlement INNER JOIN
quote ON quote.quoteId = SUBSTRING(licenseEntitlement.entComments, 12, PATINDEX('% Created%', licenseEntitlement.entComments) - 12)
WHERE (licenseEntitlement.entType = 'AVS') AND (licenseEntitlement.entComments LIKE 'OV Order + %') AND (licenseEntitlement.entEndDate < '7/1/2014')
ORDER BY licenseEntitlement.entEndDate
Solution 1:[1]
You need to give the user in question rights to SELECT from those table(s).
It is nothing to do with your query itself (given the right permissions)
However, you should be looking into Stored Procedures and giving permissions to that instead of direct access to the tables.
Solution 2:[2]
Your user doesnt have select permission on table
give either select permission or db_readonly to user
Solution 3:[3]
Execute the following statement to give user the appropirate permission
GRANT SELECT ON [dbo].[quote] TO [Domain\User] --<-- User's UserName
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ChrisBint |
Solution 2 | Saurabh Sinha |
Solution 3 | M.Ali |