delete with Y flag and I with N
please note this is no duplicate question,here output is different HI EXPERT, create tabletest19 (col1 char(23), col2 CHAR(20),col3 char(3),col4 CHAR(23),col5 CHAR(23),col6 DATETIME )and expected output is this insert into tabletest19…
performance issue
WITH MaxD AS (select t1.* from D as t1 inner join ( SELECT ID, CN, TB, MAX(BD) as MaxBD FROM ( SELECT ID, CN, TB, BD FROM [D] UNION ALL SELECT ID, CN, TB, BD FROM [M] ) AS t2 GROUP BY ID, CN, TB)t3 on t1.ID =…
find column name in db
Hey, how to find a data in the database for an example . I want to find out mobile number column from all tables in database
timestamp manupulation
Hey, here is the table & it contains timestamp at the end. check the output create table customer (CustomerName char(22), ContactName char(22), Address char(22), City char(22) , PostalCode char(22), Country char(22),time DATETIME DEFAULT…
Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
I am trying to write a case statement for my query which checks that if a person got two address on file then get the primary address else which ever one is on file. I have created a temp table for all persons address. This is my code: SELECT…
json file in sql server
could you please explain how we can load below curly bracket files in sql server when there are multiple unwanted curly brackets are there apart from main data? in this case data is available in till Result only { "Generic": { …
What is the best choice for this scenario - CTE or View
Hello Team, I have a scenario where in the source data is in an Azure SQL DB. The data in the source is stored in the form of snapshots. For Ex:- Day1 - 500K Records, Day2 - 510K Records - Day3 - 520K Records (Total - 1.53M records). All the tables the…
multiple merge condition
Hey, due to multiple merged condition in same query, it is taking lots of time to run in sql tried partition but did not work . what can be best approach?
Left Join Problem
I have two table: CREATE TABLE [dbo].[TableLeft] ON [PRIMARY] CREATE TABLE [dbo].[TableRight] ON [PRIMARY] INSERT INTO TableLeft values (1, 'TableLeft_1') INSERT INTO TableLeft values (2, 'TableLeft_2') INSERT INTO TableLeft values (3,…
Optimizing stored procedure that exceeds timeout limit
I am encountering a challenge with a Windows service responsible for generating reports using the stored procedure "Mgmt_Report". The stored procedure is subjected to a timeout period of 5 minutes. While smaller reports, typically taking 1 to 3…
Best Practice/Standard Alias Schema/Table Convention
Just looking for suggestions for best practices and/or standards for table aliases in a Query. I know this is very subjective...but just looking for some general guidelines from experts and their experience and what works and what might not work. Should…
insert delete and insert
Hi Expert, the below mentioned records having insert first then delete the same record and inserted the same record. how we can maintain delete and insert records in output. Col2 to Col4 is PK and wants to merge into this table tabletest20 (col1…
maintain last record
HI Expert, needs deleted records as mentioned below 'd' means deleted ... 'I' means inserted we need to delete the the record --- 1st inserted --- 2nd deleted same record so output is mentioned Create table table1 (col1 varchar(20),col2…
SSIS not inserting all rows from ODBC (oracle) to SQL server 2019
I have an issue with migration to SQL server 2019. My Source is Oracle and my Destination is Microsoft SQL Server 2019. My package consists of a simple Data Load task; ODBC Source Connection(oracle)/ and OLE DB Destination connection(2019 SQL…
Tuning of a delete query causing slowness
Dear Experts, There is a delete statement which is causing considerable slowness on the server and it runs after hours. Please provide recommendations to tune this query. The primary key is there on this HostNTEvent_TimeGenerated column. delete FROM…
update the rows after 1st insert
Hi Expert, there are 2 tables the DATA should insert in 1st row as it has PK(primary key) from col2 to col4 but timestamp is difference so instead of insert it should update the 2 row while inserting into table29. create table table28 (col1…
EXISTS with IN returning all rows
Hi, I have two tables Table_A and Table_B, both with very many rows. I need data from both so I am using a JOIN and then filtering on column TXNCODE and DVAL in Table_B. Column DVAL has values ONE,TWO,THREE, FOUR,FIVE,SIX and I need only…
Grouping Data
Hello there, I need a help about the SQL Query. Data example: Date Amount 2024-01-11 10:15 1000 2024-01-11 11:10 2000 2024-01-12 10:16 5000 2024-01-13 11:12 4000 2024-01-13 11:18 4000 Expeceted result: Date Amount…
IN SSIS How to change SQL Authentication to Windows Authentication
HI I was trying to deploy the packages in to server it is erroring out with the below error . TITLE: SQL Server Integration Services The operation cannot be started by an account that uses SQL Server Authentication. Start the operation with an account…
Azure SQL Database Stored Procedure long execution time issue
In my Azure SQL Database I have Stored Procedure sp_subledger (Attached the code : sp_subledger.txt) The Stored Procedure is completing within 1 min when Tenant = 1 is provided but when Tenant = 2 is provided it is running for more than 2 hours. for…