SQL Server DBA
1,625 FOLLOWERS
Learn about SQL Server DBA, SQL Server database performance,SQL Server optimisation,database tuning,t-sql,ssis,powershell.
SQL Server DBA
9M ago
Question: I'm getting this error when connecting Microsoft OLE DB Driver 19 for SQL Server & Microsoft ODBC Driver 18.x for SQL Server.
The certificate chain was issued by an authority that is not trusted
What is the fix for this error ?
Answer:
Step 1: Check if sql server Force Encryption is set to No . There are different wasys to check such as How to check SSL encryption is enabled on SQL Server with Powershell & How to check a SQL Server connection is encrypted with SSL
here is an example
DECLARE @force_encryption INT
EXEC xp_instanc ..read more
SQL Server DBA
9M ago
Following changes in the feedburner service , sqlserver-dba.com is changing the rss feed and email notification subscription service to follow.it
Email notification subscribers - We've moved your subscription from feedburner to follow.it . There is no requirement to opt-in again to rececive your content.
If you currently don't have an email notification subscription to sqlserver-dba.com than use the email subscription on the right panel , to receive regular updates on SQL Server DBA related troubleshooting and technology topics from sqlserver-dba.com
  ..read more
SQL Server DBA
10M ago
Question: I'm attempting to drop a drive on Windows 2016 but seeing space used . I've checked the drives but there are no files in the drive. I also checked "Hidden items" and no files appear . How can I identify the items taking up the space ?
Answer: These steps deal with a common problem of deleting items from the hidden folder $Recycle.bin
Note : If you think the issue it's related to the pagefile.sys you can Find Windows pagefile location through command line and wmic
Step 1 : assuming your dive is called : H:\. Open the windows cmd and execute this command:
dir ..read more
SQL Server DBA
10M ago
Question: How can I find tables in a SQL Server database that have a Primary Key ?
Answer: To identify if a table has a Primary Key - you can use the OBJECTPROPERTY method with the property TableHasPrimaryKey. This returns 1 or 0 depending on whether the table has a PRIMARY KEY or not .
Example 1 : Check if a table has a PRIMRY KEY
SELECT OBJECTPROPERTY(OBJECT_ID(N'myschema.myTable'),'TableHasPrimaryKey')
Example 2: Find all tables with Unique NonClustered Indexes and the table has no Primary Key
select schema_name(t.schema_id) as schemana ..read more
SQL Server DBA
11M ago
Question: I want to find SQL Server table columns which are using user-defined types . I also want to find SQL Server columns in which the nulability at the column level is different from the nullability set at the user-defined type level.
Answer: These are some queries you can use to find the UDT information. One thing to be aware of is that one of the purposes of UDT is to offer strong typing structure beyond the standard SQL Server types used on columns
Query 1 : Find table name , column referening user-defined types
select obje ..read more
SQL Server DBA
11M ago
Question: How can I find and report on SQL Server tables with LOB columns but where the table has no PRIMARY KEY? I'm classing an LOB column as 'TEXT', 'NTEXT','IMAGE' ,'XML', 'VARBINARY','NVARCHAR(MAX)' & 'VARCHAR(MAX)'.
I need this information for DMS & CDC processes.
Answer: The main idea is list out the LOB column tables & then check if they have a PRIMARY KEY associated. This query completes this task . The query also checks across multiple schemas across a database.
SELECT TABLE_SCHEMA + '.' + TABLE_NAME FROM INFORMATION_SCHEMA.C ..read more
SQL Server DBA
1y ago
During a routine SQL Server patching process on SQL Server some error messages appeared in the SQL Server Error Logs. As a result SQL Server was not able to start up
Configuration option 'show advanced options' changed from 1 to 1. Run the RECONFIGURE statement to install.
Error: 574, Severity: 16, State: 0.
CONFIG statement cannot be used inside a user transaction.
Error: 912, Severity: 21, State: 2.
Script level upgrade for database 'master' failed because upgrade step 'msdb110_upgrade.sql' encountered error 574, state 0, severity 16. This ..read more
SQL Server DBA
1y ago
Question: How can I find SQL Server Filtered Indexes ? We are woking on some migrations from SQL Server to other engine platform and part of the process includes locating a range of database objects . The identified objects will be recoded into the target engine plaform
Answer: This script returns a list of Indexes using the filtered index element.
SELECT sch.[Name] as SchemaName
,tbl.[Name] as TableName
,idx.[Name] as IndexName
,idx.[type_desc] as IndexType
,idx.filter_definition as IndexFilterDefinition
FROM sys.indexes idx
INNER JOIN sys.tables tbl ON tbl.ob ..read more
SQL Server DBA
1y ago
Question: Do you have a SQL Script to locate SQL Server LOB columns? I need to find them as I'm organizing a SQL Server conversions and need to identify the SQL Server LOB columns for special attention
Answer: Use this SQL Script as a starting point to identify the LOB columns in your SQL Server tables.
SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE DATA_TYPE IN
('NTEXT','IMAGE' ,'XML', 'VARBINARY','TEXT' )
OR
(data_type IN ('NVARCHAR','VARCHAR') and character_maximum_length = -1)
Find other useful details in SQL Server ..read more
SQL Server DBA
1y ago
Question: Do you have a sql query to check every sql server database column and identify if a default value is applied to the column?
Answer : This query example will return 3 columns - table, column , and default column value
use [myDB]
SELECT so.NAME AS "TABLE", sc.NAME AS "COLUMN", sm.TEXT AS "DEFAULT COLUMN VALUE"
FROM dbo.sysobjects so INNER JOIN dbo.syscolumns sc ON so.id = sc.id
LEFT JOIN dbo.syscomments sm ON sc.cdefault = sm.id
WHERE so.xtype = 'U' AND sm.TEXT IS NOT NULL
ORDER BY so.[name], sc.colid
Read more on finding other SQL da ..read more