SQL Server 2012 :: Concurrent Connection Trigger

Jun 16, 2015

I am STIGing a database and have to create a trigger that will stop any connection from occurring after a certain limit has been reached. For example I set the concurrent connection to 50 so I need a trigger that will stop any connection from all logins happening after 50.

The STIG info:
Rule Title: SQL Server must limit the number of concurrent sessions for each system account to an organization-defined number of sessions.

STIG ID: SQL2-00-000100

The below triggers works, but for only the one login, so how can I have it include all logins for that SQL instance.

CREATE TRIGGER connection_limit_trigger
ON ALL SERVER WITH EXECUTE AS 'login_test'
FOR LOGON
AS
BEGIN
IF ORIGINAL_LOGIN()= 'login_test' AND
(SELECT COUNT(*) FROM sys.dm_exec_sessions
WHERE is_user_process = 1 AND
original_login_name = 'login_test') > 3
ROLLBACK;
END;

View 2 Replies


ADVERTISEMENT

Concurrent Connection Limits

Jul 25, 2007

I'm new using SQL 2005 Express

I'm planning to use SQL Server Express 2005 for a asp net web application for a video rental store.

Is there a concurrent user conection limit that I should care?



TIA

Gerardo

View 1 Replies View Related

SQL 2012 :: Single Multi-Tenancy DB With 100K Concurrent Connections?

Aug 19, 2014

I have a DB that is currently not normalized and will be getting about 100K concurrent users that will mostly be doing Read-Only operations from multiple tables.

I am trying to figure out if I should start thinking of having a DB per client (1000 clients) or if I should normalize the database and keep it as a single DB with good indexes and partitioning.

Hardware is not a problem but 100K concurrent users is.

View 1 Replies View Related

SQL Server 2012 :: How To Create A DML Trigger

Jan 6, 2015

THe Scenario is We have Tables like parent and Child Table.

Like we have Child Table as Name AcademyContacts,In that we have Columns like

Guid(PK)Not Null,

AcademyId(FK), Not Null,

Name,Null

WorkPhone,Null

CellPhone,Null

Email Id,Null

Other.Null

Since we have given Null to ''Workphone'',''Cellphone '', ''Email ID''.when inserting the data into these table if the particular columns are empty while inserting also the data will get populate into the table.And I need is if these columns are ''Workphone'',''Cellphone'' , ''Email ID'' they cant insert the data into table.Like it must trigger like ''Please enter atleast one of these ''Workphone'',''Cellphone'' , ''Email ID'' columns.

View 5 Replies View Related

SQL Server 2012 :: Disable Only One Trigger Action?

May 6, 2014

I have a trigger that executes AFTER INSERT, UPDATE, DELETE. Is there a way to disable and then reenable only the "AFTER DELETE", letting AFTER INSERT, UPDATE act normally?

View 6 Replies View Related

SQL Server 2012 :: UPDATE Trigger Failing

Jan 30, 2015

We have an UPDATE trigger that is failing. This seems like a basic task - we want to write a record to a separate tracking table when our main transaction table is updated for any reason. Our assumption is that we have a reference to the data from the "inserted" record that was just updated. The scenario here is that we are running a batch process which READS several thousand records in our transaction table each evening.

We then mark each individual record as processed on the transaction table and expect that the UPDATE trigger will successfully fire (it is not). The version of our trigger listed below shows our attempt to deal with the fact that TransactionID does NOT exist from "inserted." We also have a version of this trigger that deals with INSERTS - it works flawlessly.

ON [dbo].[FPS_Transaction]
AFTER UPDATE
AS declare @trxId uniqueidentifier;
BEGIN TRY
SET NOCOUNT ON

[code]...

View 6 Replies View Related

SQL 2012 :: Using Linked-server During (logon Trigger)

Oct 8, 2015

Used linked-server during logon trigger? is it possible? i know we can access tables, SPs, etc with in that server, if i want to check something in other server during logon trigger, can i do it?

View 0 Replies View Related

SQL Server 2012 :: Trigger To Prevent Logon To A Database

Mar 19, 2014

OK, I know about this: [URL] ....

But the script has "ALL SERVER".

What I want is a trigger that is specific to my DB called "JunkStuff". I only want to block a servername from connect to my super dooper DB "JunkStuff".

View 1 Replies View Related

SQL Server 2012 :: Trigger For Updates On A Row Using Previous Record Value?

Mar 9, 2015

I am looking to update a record from a previous row. So if there is a value of total goods in week 1, i want that value to carry forward to the value of goods in week 2. Is there any SQL as an example of the best way to accomplish this? I can query it using lag() which works great but i need the source data itself to update as the end-users are accessing the data via lightswitch, so when they save a change, i want the trigger (or whatever you recommend) to update the source table.

View 9 Replies View Related

SQL Server 2012 :: Trigger For Update Action Without Primary Key

Jun 18, 2015

I am writing a trigger for getting values to auditlog table when the values gets updated. Below is the code of my trigger.

CREATE TRIGGER [dbo].[Update_Temp] ON [dbo].[Temptable1] FOR UPDATE
AS
DECLARE @bit INT ,
@field INT ,
@maxfield INT ,
@char INT ,
@fieldname VARCHAR(128) ,
@TableName VARCHAR(128) ,

[Code] ....

The code is working fine when the table has primary key associated. However due to some restrictions I will not be able to have a primary key for some tables. I want to implement the same trigger in those tables too. When there is primary key, that primary key needs to get inserted into the audit table and if there is no primary key, i want a specific column value to get inserted instead of the primary key value into the audit table.

For example, i have a student table in which there is a student id, name, dob. there is no primary key defined for the table. So when i update the name or dob, i need the student id to get inserted into the Pk column of the audit table.

I tried modifying the code by checking the @pkcols for Null and if its null to get the old value as the primary key however I was not able to do it .

View 1 Replies View Related

SQL Server 2012 :: Trigger Inserted Multiple Rows After Insert

Aug 6, 2014

I create a Trigger that allows to create news row on other table.

ALTER TRIGGER [dbo].[TI_Creation_Contact_dansSLX]
ON [dbo].[_IMPORT_FILES_CONTACTS]
AFTER INSERT
AS

[code]...

But if I create an INSERT with 50 rows.. My table CONTACT and ADDRESS possess just one line.I try to create a Cursor.. but I had 50 lines with an AdressID and a ContactID differently, but an Account and an AccountId egual on my CONTACT table :

C001 - AD001 - AC001 - ACCOUNT 001
C002 - AD002 - AC001 - ACCOUNT 001
C003 - AD003 - AC001 - ACCOUNT 001
C004 - AD004 - AC001 - ACCOUNT 001
C005 - AD005 - AC001 - ACCOUNT 001

I search a means to have 50 lines differently on my CONTACT table.

C001 - AD001 - AC001 - ACCOUNT 001
C002 - AD002 - AC002 - ACCOUNT 002
C003 - AD003 - AC003 - ACCOUNT 003
C004 - AD004 - AC004 - ACCOUNT 004
C005 - AD005 - AC005 - ACCOUNT 005

View 9 Replies View Related

SQL Server 2012 :: Inserting Record In Table - Trigger Error

Aug 6, 2014

I am inserting a record in XYZ table(DB1). Through trigger it will update ABC table(DB2).

I am getting error when doing above thing. What are the roles to be set to user to avoid above problem.

View 3 Replies View Related

SQL Server 2012 :: How To Get A Table Identity Inserted By Instead Of Insert Trigger

May 14, 2015

I have a problem described as follows: I have a table with one instead of insert trigger:

create table TMessage (ID int identity(1,1), dscp varchar(50))
GO
Alter trigger tr_tmessage on tmessage
instead of insert
as
--Set NoCount On
insert into tmessage

[code]....

When I execute P1 it returns 0 for Id field of @T1.

How can I get the Identity in this case?

PS: I can not use Ident_Current or @@identity as the table insertion hit is very high and can be done concurrently.Also there are some more insertion into different tables in the trigger code, so can not use @@identity either.

View 5 Replies View Related

SQL Server 2012 :: In Trigger - Building Dynamic Table With Inserted Data

Nov 4, 2015

Within a trigger, I'm trying to create a unique table name (using the NEWID()) which I can store the data that is found in the inserted and deleted tables.

Declare @NewID varchar(50) = Replace(convert(Varchar(50),NEWID()),'-','')
Declare @SQLStr varchar(8000)

Set @SQLStr= 'Select * into [TMPIns' + @newID + '] from inserted'
Exec (@SQLStr)

I get the following error: Invalid object name 'inserted'

I know I can do:

Select * into #inserted from inserted
Set @SQLStr= 'Select * into [TMPIns' + @newID + '] from #inserted'
Exec (@SQLStr)

But I don't want to use TempDB as these tables can become big and I also feel that it is redundant. Is there a way to avoid the creation of #inserted?

View 2 Replies View Related

SQL Server Admin 2014 :: Logon Trigger Executing Multiple Times For Single Connection?

Jan 30, 2015

I am trying to create a logon trigger. As I am testing this, I discovered that each time I do a connection, I get 19 rows, inserted into my audit table. I ran profiler, and I see it is going through the logon trigger multiple times, for a single connection. So, what am I doing wrong? The code is fairly simplistic, and the profiler doesn't give a clue, as to what is going on. When I look at the output, I see the spid for the first couple of connections are different, then a spid, that is different from those 2 is in the next 17 rows. But, when I do an sp_who2, that spid does not exist.

This issue was noticed on a 2012 version, that I was first testing on, then had the same issue on a 2008 R2. I am currently testing on a 2014 version, that is doing the same thing. Is the logon trigger itself, firing, and causing this?

I also tried using the After Logon option, and got the same issue.

Here is the code:

CREATE TRIGGER LogonAuditTrigger
ON ALL SERVER WITH EXECUTE AS 'sa'
FOR LOGON
AS
BEGIN
DECLARE @Body NVARCHAR(2000),

[code]....

View 0 Replies View Related

How Many Concurrent Connections Support SQL Server 2005?

Jun 16, 2006

Hi folks,
That is the question: how many concurrent connections support Microsoft SQL Server 2005?

Thanks in advance,
Javier.

View 3 Replies View Related

How Many Concurrent Users With SQL Server 2000 Standard && 2GB ??

Dec 16, 2004

Standard costs 2000 euros approx (5CALs)
Enterprise costs 40000 euros apprx

Standard only supports 2GB or RAM
How many concurrent users do you think standard edtion can handle in a Dual Xeon 2.8 with 2GB ram ?

Enterprise is very expensive. sucks that standard can't handle more than 2GB Ram

View 1 Replies View Related

SQL Server 2008 :: Max Concurrent Sessions Since Last Restart

Feb 2, 2015

Is there a way to find the max number of sessions that were on a sql server since its last restart? I know how to get how many total connections there were since last restart, and the current number of sessions, but not the max number of sessions that were running since last restart. Also, opinion on the optinum number of allowable sessions, or a good way to figure out the balance?

View 0 Replies View Related

Concurrent Queries In SQL Server 2005 Express

Nov 9, 2006

If applicable, what's the limit on concurrent queries supported by SQL Server 2005 Express? Also, if there's a limit, does next connection after the max errors out or merely queues up?



Thanks,

Phillip

View 3 Replies View Related

SQL 2012 :: Using Alias For SSAS Server Connection

Jul 14, 2015

I know how to create an alias for a SQL server instance, so instead of MyServerMyInstanceName, I can type MyInstanceName into my SSMS connection box. But SSAS does not allow me to connect with the alias.

I've looked all over and found plenty of documentation that SQL 2005 and 2008 doesn't allow the use of instance aliases for SSAS. I've even found notes from Microsoft saying "we'll fix this in a future edition." I have not found any indications or notes as to whether or not this has been fixed.

Can aliases be created for 2012 SSAS? Or is this still not available?

View 0 Replies View Related

SQL Server 2014 :: Calculating Concurrent Users In A Database?

Feb 2, 2015

I am researching this and playing with using the syss.sysprocesses view and counting the dbid column. I would most likely want to store this information in a table with a date/time stamp because we really want to track our concurrent users during the day for awhile. Do you have any neat tricks in getting this done? Is there a DMV or Information_Schema view that could be used to accomplish this task? I found the following code on the internet:

SELECT DB_NAME(dbid) AS DBName,
COUNT(dbid) AS NumberOfConnections,
loginame AS LoginName,
nt_domain AS NT_Domain,
nt_username AS NT_UserName,
hostname AS HostName
FROM sys.sysprocesses

[Code] ....

View 1 Replies View Related

SQL Server 2000 Deadlock Concurrent Select Transcations

Oct 14, 2007

There are a series of traces of transactions for essentially the same units of work. Each includes a retrieving the same table "Select" from the database. The first 4 transactions ran concurrently. The last one ran about 7 minutes later with no other concurrent transactions.

The elapsed times for the database accesses for each of the first 4 is significantly higher than the last one.
Can you think of any database optimazation that might improve this?


Are there any utilities available than can be used for stand-alone testing of SQL Server database performance?
E.G. they would measure response time for reading/writing large/small amounts of canned data once/multiple times with concurrent/nonconcurrent access.

SQL Server Database is on 2000.I am not sure about the ISOLATION level in the Java code.

Basically I am new to SQL Sever....Please ans the above questions and provide me the direction to proceed on these questions

View 5 Replies View Related

What Is Maximum No. Of Concurrent Logins Possible On A SQL Server 2005 Database?

Dec 19, 2006

what is maximum no. of concurrent Logins Possible on a SQL server 2005 Database?

View 3 Replies View Related

SQL 2012 :: SSMS 2012 Database Connection Dialog Hangs

Feb 13, 2015

I have several users with an unusual problem with SSMS 2012. When they attempt to connect to a database using the "Connect to Server" dialog box, the connection just hangs. Sometimes after about 15 minutes the connection will be successful. Other attempts simply spin seemingly endlessly. Users experiencing this issue are both running SSMS 2012 on Win 7 Pro (64 bit). The following troubleshooting steps have been tried:

1. When the user runs SSMS "As Administrator" the connections work almost instantly. (Elevating privileges is not a solution in our environment)
2. Wireshark shows that SSMS does not try to hit the SQL server when the user experiencing this issue clicks connect.
3. I can create a new virgin user on the PC and that login experiences the same problem.
4. A complete rip and re-install of SSMS 2012 does not resolve the issue.

View 3 Replies View Related

SQL 2012 :: Adding ADSI LDAP Server Connection Inside CMS Collection?

Jun 17, 2014

Is there a way to query the LDAP from inside the CMS? I know I can add a linked server in a singular instance but I'd like to do it inside a server group. I haven't found anything so far about querying the LDAP inside a server group so it might not be possible?

View 4 Replies View Related

SQL 2012 :: Client Connection Fails But Then User Is Prompted To Select Server

Apr 7, 2015

We have a database residing on a SQL Server 2012 Express system running under Windows Server 2012. I have installed the SQL 2012 Native Client on the user's workstation. I created the System DSN with the required settings and when I test the connection all tests pass. I am able to ping the server as well as connect to it via SQL Server Management Studio.

Now when the user launches the application he is presented with the dialog window as in Screenshot1 (see attached). After clicking on Ok he is next presented with the dialog window where he has to select the SQL server. See attached Screenshot2. The user selects the SQL server from the drop down list and he is then able to access the application and work normally. I cannot understand why this is happening because I have included the correct server instance in the DSN settings i.e. sqlserversqlexpress

Telling the user to select the server himself is not an option for us.

I have checked the settings on the SQL Server. TCP/IP is enabled, remote connections are allowed and there is no firewall blocking. Port 1433 has been set as the default port to use.

View 6 Replies View Related

SQL 2012 :: Executing SP From Trigger?

Mar 21, 2014

Below is my requirement..

Create trigger on Table_XYZ ( After Insert,After Update)
select @var=Col_Last field is null from inserted
if @var is null
Execute sProc1
create proc sproc1
Business logic will create two csv files. Success and error files
success record will be deleted from Table_XYZ,
Error records updated with error_message.

Problem:- When i am updating Col_Last value to null or insert a record with NULL for Col_Last

Trigger is firing and executing SP.....But i was not able query the Table_XYZ and taking too much time...

sp_who2 shows blocked by...my SPID only

when i am executing SP alone ...every thing works fine....

when i am doing testing on trigger with Insert/Update... i am getting executinf query... no response...

If i comment below ones in Trigger...working fine...

--if @var is null
--Execute sProc1

View 1 Replies View Related

Connection Level Variable For Trigger Use Possible?

May 19, 2008

I need to pass a application userid on every call to my database for triggers on the db to use.


I am connecting to my database using integrated security from my application, all on one windows domain account. However I need to get an application user id over on the connection for triggers to use to stamp in changelogs.


Currently everytime we open a connection we create a #table with the user id in it, but that is expensive, especially in our new SOA where connections are frequently created and dropped on requests.


Is there any way I can get a connection level variable over to the database server so triggers could read it?

Any help is greatly appreciated.

View 1 Replies View Related

SQL 2012 :: Create Trigger Syntax

May 30, 2014

ALTER TRIGGER [dbo].[Trigger1]
ON [dbo].[Table1] with execute as SELF
AFTER INSERT

[code]....

I am trying to create a trigger so every time a entry is made on a table, and the Colum1 is 'entry', it starts a job. But the users running the inserts do not have permission to Start jobs so I need to make it run as a super user. Where do i put the syntax in here? I Have tried Execute as login 'superuser' before the exec statement but it errors on the principal not being valid

View 1 Replies View Related

SQL 2012 :: Trigger Not Inserting Any Values?

Aug 11, 2014

I have a trigger that searches for duplicates before inserting values.

I have written the trigger however its not inputting values into the column at all.

see my trigger:

ALTER TRIGGER DUPLICATES
ONAMGR_User_Fields_Tbl
AFTERINSERT,
UPDATE
AS
Declare @AlphanumericCol varchar (750)
Declare @Counter integer

[code]....

View 5 Replies View Related

SQL 2012 :: Trigger Or Agent Job To Run SP Constantly?

Aug 22, 2014

I have a database with a table called RAW, this table receives msgs via XML, sms and various other formats. The data is written into this table at a rate of approximately 50-100 rows per minute.

I have a SP which takes the data written into the raw table and performs various actions looks for account information, writes to a log table, writes to incident table’s gets GPS information and so on.

The records written into the raw table need to be processed at almost instantly with a maximum of under a minute from when they arrive into the table.

At present there is a sql agent job which executes the SP, this consist of a step to execute the SP which on completion moves to the next step which is a loop waitfor delay and then back to step 1.

The trouble is it never actually finishes and runs 24/7 there is no break point for error handling and occasionally the records that arrive in the raw table do not get processed and the job has to be restarted for it to pick them up again.

I am looking for best way to handle this process, I thought about a trigger but the performance impact on using a trigger was too heavy to consider.

View 2 Replies View Related

SQL 2012 :: Disable And Enable Trigger?

May 25, 2015

I have a trigger that I disable so I can do some operations on a table.

After the operations are completed I do the enable using the enable trigger comand.

Do I need to do something else to put back the trigger working as it was before the disable comand?

View 3 Replies View Related

SQL 2012 :: Delete Trigger On One Table

Jun 8, 2015

I have a delete trigger on one table. When I delete a single row in this table that deleted record will be recorded to a history table.But sometimes my delete will delete more than one record. In this case also only one record is being recorded into the history table.How can I record all the deleted records into the history table when multiple records are deleted with one single delete statement?

View 4 Replies View Related







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