Sample Header Ad - 728x90

Database Administrators

Q&A for database professionals who wish to improve their database skills

Latest Questions

0 votes
2 answers
2653 views
Querying AD from SQL Server
I've read tons of questions and answers (from Pinal Dave's website, Microsoft links and everything) about my error but none of them helped me. I've found questions and answers from nine years ago to today. I created a Linked Server with proper username/password to read info from our Active Directory...
I've read tons of questions and answers (from Pinal Dave's website, Microsoft links and everything) about my error but none of them helped me. I've found questions and answers from nine years ago to today. I created a Linked Server with proper username/password to read info from our Active Directory (AD). But it doesn't matter what user I use (we tried everything, even with the most powerful user we have in the network that can make it rain if it wants) and I still get the same error: Msg 7399, Level 16, State 1, Line 16 The OLE DB provider "ADsDSOObject" for linked server "ADSI" reported an error. The provider indicates that the user did not have the permission to perform the operation. I tried to run SSMS with the user with no success. I set the security tab to run with the specific user that can read the AD. These are the queries I'm trying: SELECT top 100 * FROM OpenQuery ( ADSI, 'SELECT displayname FROM ''LDAP://myDomain.local/OU=Usuarios''' ) SELECT TOP 100 * FROM OPENQUERY (ADSI,'SELECT displayname FROM ''LDAP://myDomain.local/OU=USUARIOS,DC=MyDomain,DC=LOCAL''' ) SELECT * FROM OpenQuery ( ADSI, 'SELECT * FROM ''LDAP://myDomain.local/DC=MyDomain,DC=local'' WHERE objectClass = ''User'' ') I opened management studio with this powerful user and it still doesn't work. What can be the error here? I'm querying the AD server remotely from my machine from SSMS.
Racer SQL (7546 rep)
Jan 18, 2021, 12:16 PM • Last activity: Jul 27, 2025, 05:04 PM
0 votes
3 answers
161 views
Need to configure Availability Groups between three different SQL failover instance
We have total 6 Nodes and 3 failover cluster (Each with two node). - `Cluster1.TestAD.com`(Node1,Node2) - SQL Failover Instance (SQL1) - 1 TB Shared storage - `Cluster2.TestAD.com`(Node3,Node4) - SQL Failover Instance (SQL2)- 1 TB Shared storage - `Cluster3.TestAD.com`(Node5,Node6) - SQL Failover In...
We have total 6 Nodes and 3 failover cluster (Each with two node). - Cluster1.TestAD.com(Node1,Node2) - SQL Failover Instance (SQL1) - 1 TB Shared storage - Cluster2.TestAD.com(Node3,Node4) - SQL Failover Instance (SQL2)- 1 TB Shared storage - Cluster3.TestAD.com(Node5,Node6) - SQL Failover Instance (SQL3)- 1 TB Shared storage Now we want to create availability group setup between above three SQL instance. We plan to create new cluster (cluster4.TestAD.com ) with all six node and create Availability groups with all three instance. SQL Edition : SQL Server 2012 R2 Enterprise Is it possible? Any other recommendations ?
adkalavadia (26 rep)
Aug 24, 2016, 09:45 AM • Last activity: Jul 16, 2025, 09:04 PM
3 votes
2 answers
312 views
How to import an image from a file, using OPENROWSET, to a table record?
I am trying to import a small image from a file located on my MS SQL Server to a column in a database setup as `VARBINARY(MAX)`. I have declared a variable as `VARBINARY(MAX)` and would like to assign the image to that variable. Once assigned I have to locate the records and store that image to thos...
I am trying to import a small image from a file located on my MS SQL Server to a column in a database setup as VARBINARY(MAX). I have declared a variable as VARBINARY(MAX) and would like to assign the image to that variable. Once assigned I have to locate the records and store that image to those records. I have a query that works to store the image to the column, but for the life of me I cannot import new images from files on the servers SSD.
USE [Mydb]
DECLARE @ImageFile VARBINARY(MAX)
SELECT @ImageFile = 'Abracon.jpg'
FROM
    OPENROWSET(BULK 'C:\Users\admin\Pictures\Abracon.jpg', SINGLE_BLOB)
    AS BLOB;
Running this query gives me the following error: > Msg 257, Level 16, State 3, Line 16 > >Implicit conversion from data type varchar to varbinary(max) is not allowed. Use the CONVERT function to run this query. I read the OPENROWSET page at learn.microsoft.com, but I still don't see my error. What am I doing wrong?
Gromit (33 rep)
Jul 14, 2025, 10:09 PM • Last activity: Jul 15, 2025, 10:42 PM
0 votes
1 answers
154 views
Does Data Migration Advisor migrate system databases?
I would like to know if Data Migration Assistant copies system databases (master, model, msdb) into the new server.
I would like to know if Data Migration Assistant copies system databases (master, model, msdb) into the new server.
Rauf Asadov (1313 rep)
Aug 21, 2019, 11:48 AM • Last activity: Jul 15, 2025, 06:06 PM
1 votes
1 answers
177 views
Shredding Query Plan XML For Potential Skewed Estimates - Data Type Conversions
I'm using the below T-SQL to check for root level estimate skews in execution plans by pulling the estimated rows from the execution plans and comparing to the last rows from the sys.dm_exec_query_stats DMV. Obviously I can't do this calculation due to the data type mismatch, converting from varchar...
I'm using the below T-SQL to check for root level estimate skews in execution plans by pulling the estimated rows from the execution plans and comparing to the last rows from the sys.dm_exec_query_stats DMV. Obviously I can't do this calculation due to the data type mismatch, converting from varchar to bigint won't work in this scenario. Is there any way around this? SELECT DB_NAME(qt.dbid) AS [Database], cp.objtype AS [Cached_Plan_Type], cp.usecounts AS [Use_Counts], qp.query_plan.value('(//@CardinalityEstimationModelVersion)','INT') AS [CE_Version], qp.query_plan.value('(//@EstimateRows)', 'varchar(128)') AS [Estimated_Rows], qs.last_rows AS [Last Rows], --(qp.query_plan.value('(//@EstimateRows)', 'varchar(128)') - qs.last_rows) AS [Estimate_Skew], qs.total_logical_reads / qs.execution_count AS [Avg_Logical_Reads], CAST((qs.total_elapsed_time ) / 1000000.0/ qs.execution_count AS DECIMAL(28, 2)) AS [Average Execution time(s)], CAST((qs.total_worker_time) / 1000000.0/ qs.execution_count AS DECIMAL(28, 2)) AS [CPU Time Average (s)], qt.text AS [SQL_Statement], qs.query_hash AS [QueryHash], qp.query_plan AS [QueryPlan] FROM sys.dm_exec_cached_plans cp WITH (NOLOCK) CROSS APPLY sys.dm_exec_query_plan (cp.plan_handle) qp CROSS APPLY sys.dm_exec_sql_text (cp.plan_handle) qt INNER JOIN sys.dm_exec_query_stats qs ON qs.plan_handle = cp.plan_handle WHERE qt.text NOT LIKE '%sys.%' ORDER BY [CPU Time Average (s)] DESC OPTION(RECOMPILE); GO
Fza (652 rep)
Nov 18, 2016, 04:35 PM • Last activity: Jul 15, 2025, 05:10 PM
0 votes
1 answers
173 views
alter table which is under the load (sql server)
we have table that being used for sending sms and other notification for confirmation as second factor. Some changes in business logic requires us to alter table to make some columns NOT NULL. Our stumbling-stone is that table should be accessed during 24/7, application writes to and reads from it p...
we have table that being used for sending sms and other notification for confirmation as second factor. Some changes in business logic requires us to alter table to make some columns NOT NULL. Our stumbling-stone is that table should be accessed during 24/7, application writes to and reads from it pretty frequently and table has tens of millions rows. And when command like alter table NOTIFICATION_TABLE alter column C1 int null starting to execute it obviously tries to lock table and seemingly cannot do it because table is being used by other requests. That situation end up with that alter command hangs out and nothing happened during 5 minutes. After that timeout we stop it because do not want occasionally crush our system. Any thoughts about how we can implement this modification without stopping our system?
DotNetter (101 rep)
May 1, 2017, 04:12 PM • Last activity: Jul 15, 2025, 07:06 AM
-3 votes
1 answers
87 views
how to select column3 from rec1 value which is matched to column1 val in rec2
I am having following scenario : col1 col2 col3 10 2 13 13 4 14 14 5 15 15 6 16 From the above given table col3 value(13) in row1 is seen in col1 value(13) in row2 and this chain continues... Here my input column is col1 and i have to get col3 value where the chain ends up. Condition is col3 value s...
I am having following scenario : col1 col2 col3 10 2 13 13 4 14 14 5 15 15 6 16 From the above given table col3 value(13) in row1 is seen in col1 value(13) in row2 and this chain continues... Here my input column is col1 and i have to get col3 value where the chain ends up. Condition is col3 value should match with next row col1 value. example input-----> col1 = 10, output----->col3 = 16. Another table : col1 col2 col3 151 6 162 162 4 163 163 67 164 102 2 101 101 4 107 107 5 103 v1 2 v2 v2 4 v3 v3 5 v5 Here is my input -->(151,v1,102) , output---->(164,v5,103) Unfortunately, I am not supposed to use stored procedures. I am struggling on this for couple of hours...please help me.
vinay (1 rep)
Jun 24, 2014, 07:40 AM • Last activity: Jul 14, 2025, 01:40 PM
0 votes
2 answers
618 views
SQL server alwayson 3 Node Primary Down
I am using three node alwayson Availability Group SQL 2012 Enterprise Edition. 2 Node in DC with File Share Witness quorum also in DC and third node to be setup in DR I need to perform a DR switchover with all DC down And DR database up for applications. Can this solution work or I need to use Log S...
I am using three node alwayson Availability Group SQL 2012 Enterprise Edition. 2 Node in DC with File Share Witness quorum also in DC and third node to be setup in DR I need to perform a DR switchover with all DC down And DR database up for applications. Can this solution work or I need to use Log Shipping as third node instead of alwayson AG node. Please help on this. Thanks
mukki (11 rep)
Jun 25, 2020, 07:20 AM • Last activity: Jul 12, 2025, 11:03 PM
18 votes
11 answers
84582 views
Cannot start SqlLocalDB instance with my Windows account
I'm the administrator and simply run the command: sqllocaldb start v11.0 Result: Start of LocalDB instance "v11.0" failed because of the following error: Error occurred during LocalDB instance startup: SQL Server process failed to sta rt. Event viewer log Event ID: 528 > Windows API call WaitForMult...
I'm the administrator and simply run the command: sqllocaldb start v11.0 Result: Start of LocalDB instance "v11.0" failed because of the following error: Error occurred during LocalDB instance startup: SQL Server process failed to sta rt. Event viewer log Event ID: 528 > Windows API call WaitForMultipleObjects returned error code: 575. > Windows system error message is: {Application Error} The application > was unable to start correctly (0x%lx). Click OK to close the > application. Reported at line: 3621. I tried another (user and administrator) accounts, there were no problems with them. I uninstalled & reinstalled 2012 version of SQLLocalDB.msi but I had no luck. Do you have any idea & fix?
Nime Cloud (351 rep)
Dec 13, 2012, 04:19 PM • Last activity: Jul 10, 2025, 02:27 PM
1 votes
1 answers
166 views
Converting and removing full text files
I have a database that was created many SQL Server versions ago that has Full Text files. It is currently on a SQL 2012 server. How can I confirm that there is no data in use in the Full Text index files so I can delete them?
I have a database that was created many SQL Server versions ago that has Full Text files. It is currently on a SQL 2012 server. How can I confirm that there is no data in use in the Full Text index files so I can delete them?
longneck (375 rep)
Oct 4, 2019, 08:14 PM • Last activity: Jul 10, 2025, 07:09 AM
2 votes
1 answers
162 views
T-SQL90 vs Transact-Sql
In Sql2012 Management Studio, there are separate options for "T-SQL90" and "Transact-Sql". My .sql files always seem to open in "Transact-Sql". My question is what is a "T-SQL90" file, how does it differ from a regular transact sql file, ...and how does Management Studio automatically decide what ty...
In Sql2012 Management Studio, there are separate options for "T-SQL90" and "Transact-Sql". My .sql files always seem to open in "Transact-Sql". My question is what is a "T-SQL90" file, how does it differ from a regular transact sql file, ...and how does Management Studio automatically decide what type of file it is? (different extension? if so, what is it?) screenshot
Vman (121 rep)
Oct 8, 2020, 12:59 PM • Last activity: Jul 9, 2025, 04:04 AM
1 votes
1 answers
859 views
Run MSSQL stored procedures containing SSIS packages using Windows Authentication from another computer
I am new to MSSQL. I have a question about executing MSSQL Stored Procedure. Let me briefly talk about my development environment first: - **PC400 (Computer/Server A)**, where SQL Server 2012 is installed - **PC401 (Computer/Server B)**, where Java application is running on PC400 has SSIS project &...
I am new to MSSQL. I have a question about executing MSSQL Stored Procedure. Let me briefly talk about my development environment first: - **PC400 (Computer/Server A)**, where SQL Server 2012 is installed - **PC401 (Computer/Server B)**, where Java application is running on PC400 has SSIS project & package(s) deployed to its SSISDB. Of course, I have no problem in executing the packages **LOCALLY in PC400**. But this is not what I need. I want the java application installed on PC401 to be able to execute those packages stored in PC400. I have no problem in using a sa/temp user account with "SQL Server Authentication" to login the server: enter image description here But based on my research, "SQL Server Authentication" does not allow me to deploy/execute packages in SSISDB. Then, I found the following advice: https://dba.stackexchange.com/questions/39614/connect-to-sql-server-using-windows-authentication-from-another-pc-without-activ Let say the windows user account of PC401 is "HKB\Hello123". By creating an identical Windows user under "MSSQL -> Security -> Logins" in PC400: enter image description here my java program is able to use the following codes to execute a stored procedure in PC400 using "Windows Authentication": con = DriverManager.getConnection("jdbc:sqlserver://HKA-PC400:1433;DatabaseName=TempTest;integratedSecurity=true"); CallableStatement cs = null; cs = this.con.prepareCall("{call SP_ETL_B}"); cs.execute(); But is there any other methods to achieve this? Besides, ***I hope my java program would be able to use a sa/temp user account("SQL Server Authentication") to pretend to be a "Windows Authentication" one OR simply connect to an existing Windows user account, then to trigger Stored proc/SQL Server Agent job to run the packages in PC400.***
garethlam (11 rep)
May 4, 2022, 10:01 AM • Last activity: Jul 5, 2025, 03:01 PM
0 votes
1 answers
4368 views
SQL - Update certain database records with a loop
I have a certain IDs in a table that I would like to change a column value from false to true. How can I do a loop that goes through the specific IDs given and changes a column value from false to true? I’m not very familiar with SQL and the only option that came to mind is through a loop. This is a...
I have a certain IDs in a table that I would like to change a column value from false to true. How can I do a loop that goes through the specific IDs given and changes a column value from false to true? I’m not very familiar with SQL and the only option that came to mind is through a loop. This is a sample of my data. enter image description here Basically we have a stored procedure to change the “description” of the BetGenerationBetID given from FAILED to SUCCESSFUL example, the below will update the description of BetGenerationBetID 265809596 to SUCCESSFUL enter image description here With the above I can only update a record each time. So I want something that I can give all BetGenerationBetIDs that I want to update and changes the description of each ID at once.
chrissult (19 rep)
Apr 10, 2019, 12:03 PM • Last activity: Jul 3, 2025, 03:08 PM
2 votes
1 answers
176 views
Moved database to new server, not sure about NT AUTHORITY\* users
I just moved database to new instance of SQL Server (SQL Server 2012 Web from Amazon EC2) and am now cleaning up database users. I am not sure if/why these 2 users are needed (they exist in original database): - NT AUTHORITY\IUSR - NT AUTHORITY\NETWORK SERVICE Note that there are also 2 database sch...
I just moved database to new instance of SQL Server (SQL Server 2012 Web from Amazon EC2) and am now cleaning up database users. I am not sure if/why these 2 users are needed (they exist in original database): - NT AUTHORITY\IUSR - NT AUTHORITY\NETWORK SERVICE Note that there are also 2 database schemas with exactly the same names. I am more clear on NT AUTHORITY\IUSR - this seems to be a user for IIS. IIS is not even installed on the new instance, so this one probably can be deleted. I am not sure about NT AUTHORITY\NETWORK SERVICE (or how it got created to begin with - new databases created on new server don't have it, or NT AUTHORITY\IUSR) Neither of these 2 users exist at server level on a new instance or on an old instance.
Joe Schmoe (401 rep)
Jan 21, 2014, 02:28 AM • Last activity: Jul 2, 2025, 08:03 PM
1 votes
1 answers
177 views
dbcc checkdb errors, or msg 601 when restoring SQL 2012 backup to SQL 2016
I need to move two databases, WES and WILL from a Win2012/SQL2012 instance to a Win2016/SQL2016 instance for a software upgrade. I'm using the full backup files from the SQL2012 maintenance plans. I've verified I can restore them to the original SQL2012 instance with no errors. Restoring WES to SQL2...
I need to move two databases, WES and WILL from a Win2012/SQL2012 instance to a Win2016/SQL2016 instance for a software upgrade. I'm using the full backup files from the SQL2012 maintenance plans. I've verified I can restore them to the original SQL2012 instance with no errors. Restoring WES to SQL2016 reports no errors, but dbcc checkdb shows errors: >Msg 8939, Level 16, State 98, Line 13 Table error: Object ID 60, index ID 1, partition ID 281474980642816, alloc unit ID 281474980642816 (type In-row data), page (1:453). Test (IS_OFF (BUF_IOERR, pBUF->bstat)) failed. Values are 133129 and -4. ...etc Restoring WILL to SQL2016 stops partway through the upgrade steps with >Database 'WILL' running the upgrade step from version 805 to version 806. Msg 601, Level 12, State 3, Line 2 Could not continue scan with NOLOCK due to data movement. I thought the upgrade between versions was automatic. Is there anything else I need to do?
JeffH (11 rep)
Feb 25, 2022, 02:24 PM • Last activity: Jul 1, 2025, 09:07 PM
1 votes
2 answers
2059 views
Is it possible to query for the job schedule description?
Working on putting together a script to analyze all of the active jobs and I have nearly everything I need, but if possible I would like to be able to query for the schedules description as well. Is this possible? I am able to query for the name and ID out of ```msdb.dbo.sysschedules``` but it doesn...
Working on putting together a script to analyze all of the active jobs and I have nearly everything I need, but if possible I would like to be able to query for the schedules description as well. Is this possible? I am able to query for the name and ID out of
.dbo.sysschedules
but it doesn't seem to have the schedules description. Where can I find this information?
Jeremy S. (237 rep)
Nov 27, 2019, 05:23 PM • Last activity: Jul 1, 2025, 09:15 AM
16 votes
2 answers
4817 views
Is it possible for SQL statements to execute concurrently within a single session in SQL Server?
I have written a stored procedure which makes use of a temporary table. I know that in SQL Server, temporary tables are session-scoped. However, I have not been able to find definitive information on exactly what a session is capable of. In particular, if it is possible for this stored procedure to...
I have written a stored procedure which makes use of a temporary table. I know that in SQL Server, temporary tables are session-scoped. However, I have not been able to find definitive information on exactly what a session is capable of. In particular, if it is possible for this stored procedure to execute twice concurrently in a single session, a significantly higher isolation level is required for a transaction within that procedure due to the two executions now sharing a temporary table.
Trevor Giddings (275 rep)
Apr 18, 2019, 05:37 PM • Last activity: Jun 27, 2025, 01:57 PM
2 votes
1 answers
1678 views
Add shared folder to AlwaysOn AG Failover
We have setup a 2 node Synchronous AG with automatic failover to provide HA for our ERP application (Dynamics GP) The GP desktop client loads a number of shared reports and dictionaries from a file share currently located on one of the database servers. In order to provide complete high availability...
We have setup a 2 node Synchronous AG with automatic failover to provide HA for our ERP application (Dynamics GP) The GP desktop client loads a number of shared reports and dictionaries from a file share currently located on one of the database servers. In order to provide complete high availability this share needs to be available in the event of a failure of the primary replica. At first I thought I would just copy the folder and setup shares on the secondary replica but realized SMB is not accessible through the AG listener. My second thought was to move the share to another location however this still introduces a single point of failure and defeats the purpose of HA. My only 2 real choices are to somehow add the folder as a resource to the cluster, however the 2 nodes are virtual machines and creating a shared SAN disk would be complex Or a messier option would be to create a task that checks the server name and in the event of a failover would update DNS to direct clients via UNC to the correct server share. What would be the recommended approach for this?
Jeremie (21 rep)
Jun 7, 2017, 06:12 PM • Last activity: Jun 26, 2025, 05:02 AM
1 votes
1 answers
208 views
SQL encrypted connection home experiment
I have a home SQLserver 2012 that I managed to enable "force encryption" on, using a self-signed certificate and configuration manager. Now I find two things I can't explain: 1) Once "Force Encryption" is enabled, I expect other computers on my home network to NOT be able to connect unless the certi...
I have a home SQLserver 2012 that I managed to enable "force encryption" on, using a self-signed certificate and configuration manager. Now I find two things I can't explain: 1) Once "Force Encryption" is enabled, I expect other computers on my home network to NOT be able to connect unless the certificate has been transferred and loaded on the client machine. That worked for one client computer, but a second client computer seems to be able to connect WITHOUT the certificate being imported (using mmc, certlm.msc or certmgr.msc). 2) When I "clear" the certificate in Configuration Manager, I can still use encrypted connections. It's only when I set "force encryption" to No that connections are NOT encrypted. But then, when I set it to Yes and restart the SQLserver (without certificate selected in Protocol Properties), I can again use encrypted connections, according to: SELECT DISTINCT encrypt_option FROM sys.dm_exec_connections WHERE session_id = @@SPID Question 1 is: why can I use encrypted connections although the certificate has been Cleared in Protocol Properties? Question 2 is: why can the second client computer connect to the SQLserver although Force Encryption is enabled, and, more importantly, what is preventing any other computer to connect, why use encryption at all? SQL Server 2012 (SP3) (KB3072779) - 11.0.6020.0 (Intel X86). NO Active Directory, NOT explicitly configured in any DNS, just my ISP router.
SamBalby (21 rep)
Mar 13, 2021, 03:56 PM • Last activity: Jun 24, 2025, 06:04 PM
0 votes
1 answers
1114 views
How to deploy the SQL scripts to the local database (one-click deployment)?
How to deploy the SQL scripts to the local database (one-click deployment)? On a periodic interval, we receive .sql files from Developers. I will have to automate the process of pushing all .sql files to mapped database. I am trying to get some help on osql / batch script syntax to deploy .sql files...
How to deploy the SQL scripts to the local database (one-click deployment)? On a periodic interval, we receive .sql files from Developers. I will have to automate the process of pushing all .sql files to mapped database. I am trying to get some help on osql / batch script syntax to deploy .sql files.
goofyui (663 rep)
Apr 1, 2019, 09:21 PM • Last activity: Jun 24, 2025, 07:41 AM
Showing page 1 of 20 total questions