SQL Security :: Database Level Audit - Query Parameters For SELECT Statements

Aug 31, 2015

I have setup a Database Audit Specification as follows:

Audit Action Type: SELECT | Object Class: DATABASE | Object Name: SHOPDB | Principal Name: public

Now, when I perform a SELECT query with a bound parameter such as:

SELECT * FROM myTable WHERE name='queryname'

What I see through the Audit Logs is something like:

SELECT * FROM myTable WHERE name='@1'

I understand that it is by design that we cannot see these parameters throught Database Level Auditing. I would like to know whether it is possible to see these parameters by any other means using

(1) SQL Server Enterprise Edition,
(2) SQL Server Standard Edition, or
(3) by an external tool.

View 9 Replies


ADVERTISEMENT

Database Audit Specification To Audit Select On Certain User And Table

Nov 1, 2014

I have made a server security audit and specify from database audit specification to audit "select" on a certain user and on a certain table. I logged in by this user and made the select statement..when i run this query

"select * from sys.fn_get_audit_file('d:Auditaudit1*',null,null)"

It return a value at which time the query has done

after 15 minutes i repeated the same action, i run the audit query and the same result is showed off on the panel.is it suppose to return a list of values by how many times this user has made the select statement on that table ? for example at 5:00 pm then 6:00 pm and so on

View 1 Replies View Related

SQL Security :: How To Create Database Specifications On Newly Created Database Automatically For Audit

Jul 15, 2015

I am setting up SQL audit on sql servers in my environment based on requirement. I want to create database specifications ASAP database created. I tried DDL trigger but Audit doesn't support triggers. So I created audit specifications on model database. the only problem with this is every specification created on new database with same name.database specification name includes newly created database name or other methods to create database specifications on newly created databases.

View 6 Replies View Related

Output Parameters And Select Statements

Mar 17, 2004

Hi,

thanks for reading!

Here is my problem: I have a strored procedure that inserts some records

into one table and then selects some records from another table at the end.

The stored procedure takes several parameters, first one of them is marked as

OUTPUT. I'm using it to return an id of the inserted record. The procedure is called from asp.net code with first parameter set as ParameterDirection.InputOutput (tried with just Output as well). Now for the problem: if the the select statement at the end returns 0 records everything works and i my first parameter contains the @@IDENTITY value from the insert statement like it is supposed to.

If the select statement at the end returns 1 or more records my output parameter is not updated at all and contains the same value as before the procedure was run. All the records are inserted correctly.

if i try to return the @@identity as a plain select statement instead of through the parameter
i get System.DBNull.

I hope you can shed some light on this for me. Here is my stored procedure:



CREATE PROCEDURE cwSaveProductInquiry
@inquiryId int OUTPUT,
@libraryName nvarchar(500),
@contactName nvarchar(200),
@address nvarchar(100),
@city nvarchar(50),
@state nvarchar(3),
@zip nvarchar(10),
@phone nvarchar(50),
@email nvarchar(100),
@comment nvarchar(3000),
@productIds nvarchar(2000)

AS

INSERT INTO INQUIRY (LibraryName, ContactName, Address, City, State, Zip, Phone, Email, Comment) VALUES(@libraryName, @contactName, @address, @city, @state, @zip, @phone, @email,@comment)


--i tried including this statement at the end as well but that did not do the

--trick either

select @inquiryId=@@IDENTITY FROM INQUIRY





set nocount on
declare @separator_position int -- This is used to locate each separator character
declare @objectId varchar(200) -- this holds each array value as it is returned

if(@productIds is not null)
begin
while patindex('%,%' , @productIds) <> 0
begin
select @separator_position = patindex('%,%' , @productIds)
select @objectId= left(@productIds, @separator_position - 1)
INSERT INTO PRODUCT_INQUIRY_LOOKUP (ProductId,InquiryId) VALUES(@objectId, @inquiryId)
select @productIds = stuff(@productIds, 1, @separator_position, '')
end
end
set nocount off

Select Distinct Email from vPRODUCT_CONTACT WHERE ProductId in
(Select ProductId From Product_Inquiry_Lookup Where InquiryId=@inquiryId)

GO

View 3 Replies View Related

How To Derive Parameters In Ad Hoc SELECT Statements

Jul 7, 2007

Hi,

If I have ad hoc SQL statements created by users, which could be parameterized, how could I derive the parmeters at runtime. I cannot use CommandBuilder.DeriveParameters() as that is for StoredProcedures only.



Just use Split on the SQL string? Or is there a better way, such as a third-party .Net Component?



Thanks

John

View 5 Replies View Related

Database Level Security

Feb 7, 2008

Database level password security

View 2 Replies View Related

Security For Row Level But Not Based On Database User's Login

Apr 21, 2006

HiI need to set security for row level but not based on Database user'slogin. It should be based on the user table login. For the particularuser I need to allow only the particular records to access insert,update delete and select.Let me explain clearlyFor example think we are using asp/asp.net websiteEg:www.test.comSo take this is our website and if you try this URL then you will get awindow for Login name and password.For example the Login name is windows user name (Here windows usermeans server windows user and not client) and windows password. So ifyou have login user id you can able to login in our site and we haveanother check. We have our own usertable this table consist all theuser login names and user rights. We will check the windows user whologin in our site has rights in the usertable I mean he is present inthe usertable if he is not present then we will display a message youhave no rights to access this site.If he has login id in our usertable then he allowed viewing ourpages. Still if he has the login id we will check the user who loginhas how much right to access to each page and the records of each tableits all depend on the user rights.So, here I need the row level security. For each and every table weneed to check the corresponding user and executing the record producelot of business logic problem for us.So after the user login we need automatically to set row levelsecurity for all the tables. Based on the user who login.So from there if we try select * from <tablename> then we can only ableto get the allowed records to select, insert, update, delete.Please can some one help how to solve this?Note:For some help you can refer the below URL (See in that they only givenabout the row level and column level security for each database usersnot for our required concept)http://www.microsoft.com/technet/pr...5/multisec.mspxThanks in advanceRams

View 1 Replies View Related

Schema-level Security For Multiple Users In One Database

Apr 17, 2007



My developers would like a 'sandbox' database with full ddl and dml permissions, however, they do not want others to read/change/drop their objects. With SQL 2005, can DDL permissions be granted to a user at the schema level? I'd rather not set up a database for each developer.

View 3 Replies View Related

Audit Delete Statements

Sep 21, 2007

Hi

I was curious whether it's possible to audit DELETE statements in the MS SQL database. I created a procedure (below), but I didn't find any event associated with DELETE statements.

Any help will be greatly appreciated!

Thanks,
Alla

CREATE proc sp_Turn_Audit_On
as
/************************************************** **/
/* Created by: SQL Profiler */
/* Date: 11/15/2006 05:16:40 PM */
/************************************************** **/


-- Create a Queue
declare @rc int
declare @TraceID int
declare @maxfilesize bigint
declare @StatusMsg varchar
declare @ServerTraceFile varchar
set @ServerTraceFile = 'E:Program FilesMicrosoft SQL ServerMSSQLTraceAudit_Info'
set @maxfilesize = 1024

-- Client side File and Table cannot be scripted

-- Set the events
declare @on bit
set @on = 1

exec @rc = sp_trace_create @TraceID OUTPUT, 0, N'\hostnamedbauditlogmy_dir', @maxfilesize, NULL
print @TraceID

if (@rc != 0) goto error
exec sp_trace_setevent @TraceID, 14, 1, @on
exec sp_trace_setevent @TraceID, 14, 6, @on
exec sp_trace_setevent @TraceID, 14, 9, @on
exec sp_trace_setevent @TraceID, 14, 10, @on
exec sp_trace_setevent @TraceID, 14, 11, @on
exec sp_trace_setevent @TraceID, 14, 12, @on
exec sp_trace_setevent @TraceID, 14, 13, @on
exec sp_trace_setevent @TraceID, 14, 14, @on
exec sp_trace_setevent @TraceID, 14, 16, @on
exec sp_trace_setevent @TraceID, 14, 17, @on
exec sp_trace_setevent @TraceID, 14, 18, @on
-- Set the Filters
declare @intfilter int
declare @bigintfilter bigint

exec sp_trace_setfilter @TraceID, 10, 0, 7, N'SQL Profiler'


-- Set the trace status to start
exec sp_trace_setstatus @TraceID, 1
--SELECT @StatusMsg = 'sp_trace_setstatus' + ' Error - ' + @TraceID
-- display trace id for future references
select TraceID=@TraceID

goto noCursor

error:
select ErrorCode=@rc

noCursor:
return


GO
exec sp_procoption N'sp_Turn_Audit_On', N'startup', N'true'
GO

View 3 Replies View Related

Logging All SSIS SQL Statements For Audit

Nov 16, 2007



Has anyone attempted (with success) to capture the sql command text from SSIS packages at runtime for logging?
What approach was used?

ProjectREAL used a stored proc to execute all sql statements.
This seemed rather poor in design (formulate a string to pass to the sp just to log the sql command text).
This especially seemed problematic as the stored proc would have to be on the source system.

I have been trying to store my sql in variables which were set to eval as expressions and was hoping to use an ExecuteSQL task in the PreExecute event handler for each task, source, transform or destination which I required logging of the sql command text.

Problem is that, depending on how the expression is formulated (with coding parameter markers or replacing parameter's markers with values) I might only get the pre-parameter replacement version of the sql command text rather than the final parameter replaced sql command text. Also not sure that this design would work with destinations.

Any tricks of the trade to share?

View 1 Replies View Related

Is It Possible To Audit Failed Insert, Update And Delete Statements?

Oct 25, 2004

Auditors want us to track when Insert, Update and Delete failures occur. Is this possible in SQL 2000?

They also want us to track schema changes. Is this possible?

Thanks, Dave

View 5 Replies View Related

Using SQL Query Columns In Select Case Statements

Jun 5, 2006

I am using Visual Web Developer Express 2005 as a test environment.  I have it connected to a SQL 2000 server.  I would like to use a Select Case Statement with the name of a column from a SQL Query as the Case Trigger.  Assuming the SQLDataSource is named tCOTSSoftware and the column I want to use is Type, it would look like the following in classic ASP:
Select Case tCOTSSoftware("Type")
      Case 1
         execute an SQL Update Command
     Case 2
         execute a different SQL Update Command
End Select
What would a comparable ASP.Net (Visual Basic) statement look like?  How would I access the column name used in the SQLDataSource?

View 6 Replies View Related

Select Query Involving Many JOIN Statements.

Mar 19, 2008

Is it possible to have an AND within an inner join statment? The below query works, except for the line marked with --*--.

The error I get is the "multipart identifier pregovb.cellname could no be bound", which usually means that SQL server can't find what I'm talking about, but it's puzzling, as I've created the temp table with such a column in it.

Is there a different way i should be structuring my select statement?

SELECT [Survey Return].SurveyReturnID, '1', #temp_pregovb.paidDate, #temp_pregovb.email
FROM #temp_pregovb, [Survey Return]
INNER JOIN SelectedInvited ON
[Survey Return].SelectedID = SelectedInvited.SelectedID
--*-- AND [SelectedInvited].cellref=#temp_pregovb.cellname

INNER JOIN [panelist Contact]
ON SelectedInvited.PanelistID=[Panelist Contact].PanelistID
WHERE
[panelist contact].email=#temp_pregovb.email
AND SelectedInvited.CellRef IN (
SELECT surveycell
FROm [Survey Cells]
WHERe SurveyRef='5')

View 3 Replies View Related

How To Use Query Analyzer To Find The Most Efficient One In Many Select Statements?

Nov 8, 2006

Hi, everyone.

I have read a lot of topics about execution plan for query, but I got little.
Please give me some help with examples for comparing different select statements to find the best efficient select statement.

Thank you very much.

View 4 Replies View Related

User Security Audit

Jan 16, 2008

What is the easiest way to find out what objects a security login has mapped to it? Something that would show all the explicit grants a specific user has.

View 6 Replies View Related

Any Way To Run A Invisible Trace On Security Audit?

Apr 21, 2004

Is there anyway I could run an Audit trace on SQl Server which records SQL Server System Admin Login/Logout , failed login and machine names I don't want the trace window to show on screen however would like a file generated for later viewing. Also due to Firewall issues we have, We don't have SQL tools enabled to connect to that server.

View 2 Replies View Related

Script To Audit My SQL Servers Security

Mar 28, 2002

ask2much writes "I am trying to write a script that will audit my sql servers looking for weaknesses etc. I need it to report things like users with NULL paswords, users with excessive acces rights, users with direct access to tables, etc. I need a query that will give me a list of all the users in the server, the last time they logged in, and the last time they changed their password. How can I accomplish this? also if any one has already created a script similar to the one I am trying to create, could I please take a look at it to get some ideas?

thank you,

FV."

View 1 Replies View Related

SQL Security :: Select (Read) Permission On Database

Oct 26, 2015

What is the correct way to create a security group that allows the group members to Select (Read) the content of a database?

1. Create a security group in AD
2. Add the required members to the group
3. Add the security group as a login on the SQL server (Under Security>Logins)
4. Add the security group to the specific database with Grant in Connect and Select

View 11 Replies View Related

Select With From Database With A List Of Parameters

May 15, 2008

Hi, i have a big problem. I´m having trouble with the select statement in SQL query language. The problem is that I need to retrieve various data from database and the input object is a list. The simple way of doing this is:SELECT <return values>FROM <datatable name>WHERE (<select data parameter>)My problem is that my where parameter needs to be an array list. The simple way of solving the problem would be using a for statement in my c# code and call my store procedure various times, but my array list can be too long and take a long time to connect and search data for each statement, so I need to access the database once.Can anybody help; I would appreciate it very much thx, Malcolm

 

View 8 Replies View Related

Row Level Security

Mar 9, 2006

I am looking for a way to implement row level security on my SQL Server 2005 Express database.  Thanks in advance for any input.

View 1 Replies View Related

Security On Row Level ?

Feb 9, 2005

How can I apply security on row level ?

I want to use internal SQLSever users and roles.
Some users or roles should have only access to a limited numbers of rows.

The table contains a field "Company" and there are several companies.
The users should have acces only to their own company.

Thanks

View 1 Replies View Related

Row Level Security

May 23, 2008

Hi Folks,

I have the following Problem:
( not simular to
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=101916 )



In one Table ( Objects ) exists an Id to my internal Security Tables, where the combination of many Features together results in, which Data the user could see.
Today, i use only one SQL Account and the Security ist solved in my Application,
In an SP is a where Clause generated, every SQL Statement is extended whitch this where clause.
This work fine, but everyone with SQL User and PW could see everything this the Query Analyser or Management Studio.



The perfect solition could be:
Several Usergroups should have Access to my DB.
Only a few Views / SP where execuable for these Usergroups.

The Application calls alway the same View / SP an depending on the Login the Data ist filtered in the right way.

Is ist possible to filter a view with dynamic SQL ?

2.nd Question:

Is it possible to restrict Users / roles depending on the Network IP Address / Network Mask ?

The Security Problem only exists, when Users with VPN are connecting, internal Users always have full access.

Thanks an greeting from Germany,
Markus

View 1 Replies View Related

ROW LEVEL SECURITY

Jul 20, 2005

How can I implement "Row Level Security" in SQL Server 2000?Thanks alot.

View 1 Replies View Related

Which Level Of Security

Jan 18, 2007

I am attempting to create a view only user in Report Manager which can only view and run reports from a single directory. I have the following configured:

Active directory Group: DomainReport Users - Group Scope: Global; Group Type: Security; Member of: <none>

Active directory User: DomainReportUser - Member of: DomainReport Users group

Default web site Reports virtual directory: Directory security: Integrated Windows Authentication only

Default web site ReportServer virtual directory: Directory security: Enable Anonymous Access (user: domainadministrator) & Integrated Windows Authentication

Report Manager

Site Settings->Item-level roles: New role: Report Viewer; view folders and view reports only items selected

ReportFolder(Report Manager folder with reports): Properties->Security: Added DomainReportUser with Report Viewer role

When I go to my Report Manager site (e.g. http://url/reports) I get the Windows security form, in which I enter the DomainReportUser credentials. However, after I log in I have full rights to all folders and functions of Report Manager, as if I logged in as BuiltinAdministrator.

At what level of security is this breaking down? As far as role-based, I believe DomainReportUser should only have access to limited resources of Report Manager when logging on. What is allowing him to have Content Manager control of Report Manager? Is there a better way to set up a "view reports only" user access to Report Manager?

Thanks

View 1 Replies View Related

Row Level Security

Mar 9, 2007

Posting again in hopes that someone has a solution..

I've set up a sales report that is by territory. Two tables one of which has

sales detail records and another table with Sales Rep info, including territory and

login.. The two tables are joined by state. What I need to be able to do is schedule

this report to run on Reporting services(Already setup) and only allow the reps

to view a snapshot, don't want anyone executing the report again. Additionally,

I need them to only see the territory that they are responsible for. Does anyone

have a solution for this.

Thx again

View 2 Replies View Related

SQL Server Admin 2014 :: Audit All Server DDL Level Events?

Mar 6, 2015

I have been tasked with auditing all DDL and selected DML events on a production server and logging them to a table. My solution is to use CDC for the DML and a Server-Level trigger for the DDL. Because there should never but much DDL activity on the server (except when performing update tasks) I don't need to worry about the trigger consuming too many resources.

My question is this: Is there any single specification such as DDL_LEVEL_EVENTS that can capture all DDL activity or do I need to specify each and every DDL action in the trigger?

View 1 Replies View Related

How To Perform SELECT Query With Multiple Parameters In A Single Field In A Table

Sep 13, 2006

i just can't find a way to perform this Select Query in my ASP.Net page. I just want to find out the sales for a certain period[startDate - endDate] for each Region that will be selected in the checkbox. Table Sales Fields:       SalesID | RegionID | Date | Amount   This is how the interface looks like.Thank You.

View 1 Replies View Related

Security Record Level

Dec 8, 1999

Can I set up the security so that a user could only see certain records (a filter)?
TIA!

View 1 Replies View Related

Column Level Security

Apr 29, 2008



Hey,
I have 3 columns in a table Ex:
Select Column1,Column2,Column from TableName

No. 1. Person A should have permission to read values only (Column1, Column3 of the table) -
2. Person B, should have permission to read only (Column 2).

Here my question is , I have to write one single stored procedure to statisfy both conditions. Which means, if person A execute this stored procedure , he shoud get only column 1 & 3 values . similarly other person b should get column 2 value. Ex:
Column 1 - Empid
Column 2 - SSN (Only for Top user display)
Column 3 - Join Date
Person A & B as a SQL or Windows login

Thanks



View 1 Replies View Related

SQL 2005 - .Net SqlClient Data Provider: Msg 0, Level 11, State 0, Line 0 - Error Parsing Statements

Nov 2, 2006

Hi,

Does anyone else have this error message pop up in SSMS when you try to parse sql statements:

.Net SqlClient Data Provider: Msg 0, Level 11, State 0, Line 0

A severe error occurred on the current command. The results, if any, should be discarded.

There was a thread back in March 2006 that mentioned this error, but the posted resolution was to install SP1.  I have SP1 installed but I still get the error.

I only receive the error when I'm parsing statements, if I run the statement it's fine.

 

Thanks

Matt

 

View 8 Replies View Related

SQL 2012 :: User For Row Level Security

Feb 19, 2014

In database we are planning to implement row level security.For this we need to create users or we need create login for each one?

View 1 Replies View Related

Data Level Security In Reports

Aug 30, 2007

Hi Experts,

Hi experts,

I have a BI Reporting scenario, wherein i have to fetch Reports from analysis Services.
when the user tries to access a report, he should be validated uisng the Windows Authentication ID, and only data specific to that user should be display.
I am not sure if this user authentication is to be done on analysis Services/reporting services.

Any suggestions/pointers would be highly appreciated.

Thanks


Alicia Rose

View 1 Replies View Related

Row Level Security Across Multiple Columns

Nov 5, 2005

I need to secure a datawarehouse table at the row level based on 1 tomany keys on that table. A user should only see the rows they haveaccess to. I need to be able to figure out which rows they have accessto using a single sql statement and it cannot be dynamic SQL or astored procedure (this is a limitation based on the reporting tool weuse).The conditions can be any combination of "and" and "or" operators. Ihave seen posts (and actually have three of his books) by Joe celkodescribing disjunctive canonical form. If not familiar please clickthe link below.http://groups.google.com/group/comp...db6abcfa6209d2fA rules table in disjunctive canonical form looks like it mightpotentially be a solution, but I can't figure out how to use it acrossmultiple keys.Here ia an example of what I am trying to do including current tablestructures and sample data. I cannot really change the generic_facttable schema, but the security cross reference table can be modified oraditional tables added.CREATE TABLE generic_fact (generic_fact_key int NOT NULL ,salesrep_key int NOT NULL ,product_key int NOT NULL ,customer_key int NOT NULL ,sales_amount decimal(18, 0) NOT NULL ,CONSTRAINT PK_generic_fact PRIMARY KEY(generic_fact_key))GOinsert into generic_fact values(1,1,10,20,45)insert into generic_fact values(2,1,10,21,90)insert into generic_fact values(3,1,11,22,17)insert into generic_fact values(4,2,10,20,32)insert into generic_fact values(5,2,13,25,6)insert into generic_fact values(6,2,12,24,56)insert into generic_fact values(7,3,11,34,75)CREATE TABLE security_cross_reference (cross_ref_key int NOT NULL ,user_key int NOT NULL ,security_type varchar (50) NOT NULL ,security_value int NOT NULL ,security_operator varchar (20) NOT NULL ,CONSTRAINT PK_security_cross_reference PRIMARY KEY(cross_ref_key))GOinsert into security_cross_reference values(1,1,'product',10,'or')insert into security_cross_reference values(2,1,'customer',21,'or')insert into security_cross_reference values(3,2,'customer',20,'and')insert into security_cross_reference values(4,3,'salesrep',3,'and')insert into security_cross_reference values(5,4,'salesrep',1,'and')insert into security_cross_reference values(6,4,'customer',22,'and')insert into security_cross_reference values(7,4,'product',11,'and')So based on the data in the security cross reference tableUser 1 can see sales for customer 21 or product 10(generic_fact table rows that have generic_fact_key values of 1,2,and4)User 2 can see sales for customer 20(generic_fact table rows that have generic_fact_key values of 1 and 4)User 3 can see sales for salesrep 3(generic_fact table rows that have a generic_fact_key value of 7)User 4 can see sales for salesrep 1 and product 11 and customer 22(generic_fact table rows that have a generic_fact_key value of 3)Does anyone have any ideas on the best way to do this?

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved