No drag and drop on SQL Server Management Studio on external display after installing update KB5051987
After installing the following update last Tuesday, I've lost the drag and drop feature in SQL Server Management Studio: 2025-02 Cumulative Update for Windows 11 Version 24H2 for x64-based Systems (KB5051987) The mouse drag'n'drop is completely disabled…

Function on Column used in Index - need optimization advice
First, is this the proper forum for MS SQL tsql questions? Why am I seeing only 114 questions? OK, so we have a table ods_DDAHIS which has a TransDate column that is numeric in format YYYYMMDD. There is an index on ods_DDAHIS.Transdate. Then view…
How to add total sum of per Customer under each ID
I have a demo table like this: OrderID CustomerID ProductID OrderAmount OrderDate 1 101 201 100.00 2024-08-01 00:00:00.000 2 101 202 150.00 2024-08-03 00:00:00.000 3 102 201 200.00 2024-08-10 00:00:00.000 4 101 203 120.00 2024-09-15…
Request: Safe Updates Feature in SQL
This feature prevents UPDATE or DELETE queries from executing unless they include a WHERE clause or a LIMIT. It's a safeguard against accidental table-wide modifications and helps maintain data integrity. I believe SQL Server would greatly benefit from a…

High parallelism in Query Store.
Greetings. As you see in the screen shot the bulk of my wait time is going to one wait type. A few fun facts: This is in a reporting type DB with the bulk of activity coming from ETL and Power BI queries, no OLTP type stuff at all. Maxdop on the…
Need tsql to find index usage on views
I have some views that have indexes and i want to get their usage - seeks, scan, lookups - but i cannot find the tsql code.
SQL gaps and island issue
Greetings!!! We're working on migrating data from a legacy application and have a requirement to get all the consecutive SESSION START_DATE & END_DATE. For the SESSION_ID - 8642, SESSION_TYPE - 3256, based on the requirement using sql server query…

How to figure out the total number of doses within a time span given to a client as dose are being added and stopped.?
If the cadence values are different, even if the dates overlap the records must be separate. If an order for the same dose and cadence value (including nulls) starts on the same day or the next day (+or-1 day) the record should continue. outlook of…
A Simple SQL Query
I have the following table:- I want Col 1 and Col 2 where Col2 =1 and the corresponding all the values of Col 1 where Col 1 =2. But this is an example. I can find 1st part (i.e,, Select Col1, Col 2 from Table1 where Col 2 =1). But my problem is how do…

How to write a Simple TSQL
I have the following table:- I have two requirements. the 1st one is, I need ColA and ColB when ColB is 1. So the query would be:- Select ColA, ColB from Table1 where ColB =1. The Output of the 1st requirement is:- Now the 2nd requirement is, as the…
Seeking advice on deleting Indexes
Re: Seeking advice on deleting Indexes We have a nightly ETL with a table update that runs about 90 minutes that i want to optimize. There is a WHILE loop that executes 24 times (And no, there is no way to take the WHILE loop out of the processing and…
Invalid output when trying to invoke stored-procedure returning output from entityframework core -
Hi gents, can you sort out the following for me. Let me explain the scenario in detail. I have a MSSQL stored procedure that returns me output value. The output value is of int type. Stored Procedure: CREATE procedure…

Alternative approaches for Recursive CTE in SQL server. The data is 1 million records. need to calculate the current value based on previous value and iterate through Million records. Please suggest a methods which performs better than Recursive CTE
here is the query for your reference. Thanks! Alternative approaches for Recursive CTE in SQL server. The data is 1 million records. need to calculate the current value based on previous value and iterate through Million records. Please suggest a…

COALESCE and CONCAT Address Line 1 and Address Line 2 separated by a comma
We are trying to COALESCE and CONCAT Address Line 1 and Address Line 2 separated by a comma "," from potentially two data sources. So like...123 Main St., Apt. 101 The first part is easy enough... CONCAT ( COALESCE ( LTRIM (RTRIM…

How to get the current row value based on previous row value in sql server- ex first row has value, calculate the second row value using first row and some conditions and 3rd using 2nd row and same conditions
when basin <> prebasin, numberinbasinnew=numberinbasin. when basin=prebasin use the numberinbasinnew from the first row (basin<>prebasin) and calculate the second row value for numberinbasinnew based on below conditions -- CASE …
Sql server how to change column type from int to date
Sql server how to change column type from int to date

"Data Flow Task:Error: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER. The AcquireConnection method call to the connection manager ""Oracle_XXXX"" failed with error code 0xC0014009. There may be error messages posted before this
SSIS using task factory component and brings data from Oracle to SQL Server. SSIS package execute successfully on dev SQL Server environment and it returns errors on production. It runs scheduled as a job. Both servers are 2019 and identical. Here is the…
remove duplicates
hi all, I have this kind of duplicates: ID Line Amount === === ====== 100 1 1000 100 2 100 100 1 100 100 2 1000 101 1 2000 101 2 500 101 3 …
Account ledger query with debit and credit
Hi All respected community member, i am trying to develop ledger query from long time still i could not get ,please do review and help me out , if you have any suggestion for restructure #tbl_Transection_test table ,please let me know or guide me…
Split one column into multiple column
Dear my friends, I have a question about how to split one column into multiple column ? I've try the code but it doesn't work Does anyone could help me ? Thank You for your help Best Regards, Steve Henry