Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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
like image 418
jwrit Avatar asked Oct 28 '25 04:10

jwrit


1 Answers

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.

like image 183
ChrisBint Avatar answered Oct 29 '25 17:10

ChrisBint



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!