Sql Server to Excel
Hi Trying to export data from sql server to a Table formated excel. But after the data insert the Format of excel not coming properly. I mean the odd and even rows with different color Thanks
SQL Server Transact-SQL

SQL Server Management Studio 18 - Maintenance Plan
I have setup SQL backups to run daily at midnight for 5 servers, all works fine except 1 server does not run/create backup files. No errors or logs just does not run and not sure why. Any suggestions? Thanks! David
SQL Server Transact-SQL

Copying all tables from one Azure Managed Instance database to another
What is the best method to copy all tables from DatabaseA to DatabaseB in an Azure Managed Instance, including all object-level permissions, triggers, views, and indexes? The Export/Import and SELECT * INTO methods are known not to retain object-level…
SQL Server Transact-SQL

SQL Server Limitations that aren't Solved
I use Sql Server 2022. I'm running Select queries using hundreds of words, and I need to know, for each matching record, which words were found. After running the Select query, I now have to run hundreds of searches for each word in each record, and…
SQL Server Transact-SQL

Query related to length in CAST and Output clause
Hi Team, Could you please reply to below queries - Using CAST, I need to convert BigInt and Datetime2 values to Varchar. How could I be sure on the length that I need to use (in CAST) to convert these values to Varchar. I am using Update statement…
SQL Server Transact-SQL

BCP OUT/IN, What is native format and its usage. I am planning to use BCP out/in to export & Import table data from source to target and would like to know which is the best option when my data contains special character inside it and also have some email
BCP native format when to use when not to use. Is there any alternative BCP utility to export and import data from source to target table
SQL Server Transact-SQL

SSMS got corrupted user settings and now SQL Prompt is no longer working
Good morning, I access SSMS through VDI. Today when I tried to open SSMS I got a message that my user settings got corrupted and do I want to restore from some long path. I believe I answered yes on that question. The connect server dialog didn't have…
SQL Server Transact-SQL
com.azure.core.management.exception.ManagementException: Long running operation is Failed or Cancelled. Error
This is happening quite frequently now. When I am creating Elastic job agent I get com.azure.core.management.exception.ManagementException: Long running operation is Failed or Cancelled. Now this error is happening with every api call. I am using…
SQL Server Transact-SQL
Why are query executed first blocked by update executed later
There are sessions 1-4, and session 1 is update, which is used to block the environment needed for other sessions to form. Symptom 1: Sessions 2 and 4 are select and 3 are update. 1-2-3-4 is executed in sequence. Once session 1 is terminated, I expect…
SQL Server Transact-SQL
External Activation and Microservices Question
Hello, I am working on a proof-of-concept for my company using SQL Server and Service Broker External Activation to send messages from a database to a console application (both .NET and .NET Framework). I successfully created the working POC on my local…
SQL Server Transact-SQL

Applying Non clustered Index on a table with no clustered index
Hi Team, I am working on to improve the performance of a Stored Procedure in SQL Server Database. Table scan is happening on a table on which there is no primary key defined. Structure of table is as such that primary key could not be defined on the…
SQL Server Transact-SQL

Improving SP performance using Non Clustered Index.
Hi Team, I need to improve performance of a SP which is in a Database in SQL Server. 1.One of the Select query uses a Table, which is having clustered index on Column A. This table is joined with other tables on columns A,B and C(all are columns of same…
SQL Server Transact-SQL
SQL 2022 -- cte + insert doesn't work
Good day, I have the following simple SQL statement: DELETE FROM stg.stg_facets_solo; ;WITH cte AS ( SELECT * , COUNT(*) OVER (PARTITION BY f.taxid) AS cntNpi , COUNT(*) OVER (PARTITION BY f.npi ,…
SQL Server Transact-SQL
How to fix connectivity timeout issue between azure function and azure sql server.
We are trying to connect to SQL database using azure function. We are facing a connectivity timeout issue. Below is the error message :- 4/7/2025, 4:10:22.220 PM An error occurred in updateDatabase: RequestError: Timeout: Request failed to complete in…
SQL Server Transact-SQL
Changing Primary Keys for Existing Tables Containing Data
Hi, Running SQL Server 2008 R2 SP3. We are working on implementing some DDL changes with the goal of improving overall performance. Aside from indexing strategies we would like to change the data type of primary key columns from varchar to bigint. …
SQL Server Transact-SQL

SQL Server 2019 replace() function does NOT replace char(30) with empty string properly
I ran across a funny bug in SQLserver 2019, when trying to replace char(30) (ascii character 30) in a string, with an empty string (effectively removing the char30 from the string), the replace() function also strips all trailing spaces in the string.…
SQL Server Transact-SQL

Adding Conditional Not Null Constraint to Table
Hi, Running SQL Server 2008 R2. DDL below: CREATE TABLE [dbo].[Test] ( [TestID] [bigint] NOT NULL IDENTITY, [Column1] [varchar](50) NOT NULL, [Column2] [varchar](50) NULL, [Column3] [varchar](50) NULL, [Flag] [bit] NOT NULL, CONSTRAINT…
SQL Server Transact-SQL
How to change identity column in Clustered Index from int to big int for a 42gb table
Re: How to change identity column in Clustered Index from int to big int for a 42gb table I have a 43 gb table, with 30 mil rows, that has a clustered index with three fields. the third field is an integer identity column - col3 - that is now at…
SQL Server Transact-SQL
How to migrate the data from on-prem MS SQL server blob table (having structured and un-structured data) to AWS RDS using MS SQL Server
I have a table contains 7 columns. CREATE TABLE DEV.My_Files ( file_id INT IDENTITY(1,1) PRIMARY KEY, -- Unique identifier for each file filename NVARCHAR(255) NOT NULL, -- Original file name file_extension NVARCHAR(10) NOT NULL, --…
SQL Server Transact-SQL
Access query giving errors I can't explain
I have a complex query (below) INSERT INTO SCHEDULE ( SONo, CustomerID, CustomerName, OrigQty, BalDueQty, UpdatedOn, ReqDt, DueDt, PricePerLb, ActTotal, OrderDt, ShippingMethod, PONo, PartNoReqd ) _SELECT SOsWithoutMatchingSCHEDULE.SONo,…
SQL Server Transact-SQL
