This piece of T-SQL displays all the identity columns in all the tables in a Database.
Use Adventureworks
Go
Select o.name, i.name As 'ColumnName'
From sys.identity_columns i, sys.objects o
Where i.object_id = o.object_id
Go
Showing posts with label SQL Database. Show all posts
Showing posts with label SQL Database. Show all posts
Thursday, November 20, 2008
Tuesday, November 11, 2008
Lock Monitor
Lock Monitor thread detects deadlock. It does that by inspecting processes ecery 5 seconds to determine if there are any deadlock cycles. When it finds one, it automatically chooses one thread as the deadlock victim. It then rolls back the
victims transaction, cancel its query and returns error 1205.
The Lock Monitor chooses the deadlock victim by choosing the least expensive transaction to roll back.
You can overide this by using SET DEADLOCK_PRIORITY to low
victims transaction, cancel its query and returns error 1205.
The Lock Monitor chooses the deadlock victim by choosing the least expensive transaction to roll back.
You can overide this by using SET DEADLOCK_PRIORITY to low
Wednesday, October 15, 2008
Database Collation
The following code returns the collation settings of AdventureWorks database.
SELECT DATABASEPROPERTYEX('AdventureWorks', 'Collation') SQLCollation
To display your own database collation, substitute the AdventureWorks Database with your own database.
SELECT DATABASEPROPERTYEX('AdventureWorks', 'Collation') SQLCollation
To display your own database collation, substitute the AdventureWorks Database with your own database.
Monday, October 6, 2008
Error when configuring database mirroring
This error occurs when configuring database mirroring on a stand alone PC. One or more of the server network addresses lacks a fully qualified domain name (FQDN).Specify the FQDN for each server, and click Start Mirroring again.The syntax for a fully-qualified TCP address is:TCP://.[.]:
--------------------------------------------------------------------------------------
To trouble shoot this error, do the following below.
Right click on the "My Computer" then properties.
Click on the "computer name" tab, then click on the change button next to the "To Rename this computer or join a domain.
click change" then you see the "Computer name changes" window, click the "More" button on it. You will see the "DNS suffix and NetBIOS ComputerName" window. Here, type "local" to the "Primary DNS Suffix of this Computer" textbox. then press OK 3 times and restart computer.
After put this "computername.local" to your computer name for the mirroring computer server network address.
If you are in domain environment, just use really the FQDN.This is applicable just in case of stand alone machine.
--------------------------------------------------------------------------------------
To trouble shoot this error, do the following below.
Right click on the "My Computer" then properties.
Click on the "computer name" tab, then click on the change button next to the "To Rename this computer or join a domain.
click change" then you see the "Computer name changes" window, click the "More" button on it. You will see the "DNS suffix and NetBIOS ComputerName" window. Here, type "local" to the "Primary DNS Suffix of this Computer" textbox. then press OK 3 times and restart computer.
After put this "computername.local" to your computer name for the mirroring computer server network address.
If you are in domain environment, just use really the FQDN.This is applicable just in case of stand alone machine.
Subscribe to:
Posts (Atom)