Separating Name to First Name Last Name and Middle Name
Separating Name to First Name Last Name and Middle Name Have a Name Column holding a name with a format that varies case only two words exist in Name, I need to separate name into firstName and LastName and delete comma if exist case…
How to get the non null row before the row with null value
Hi I want to see the non null row before the row with NULL value in the result set. I have data in below in format I want to see ID 2 row in the result set like below Help with this would be appreciated.
Msg 22050, Level 16, State 1, Line 0 Failed to initialize sqlcmd library with error number -2147467259.
DECLARE @RowId NVARCHAR(255) DECLARE @Query NVARCHAR(MAX) DECLARE @Header NVARCHAR(MAX) SET @RowId = '[sep=,' + CHAR(13) + CHAR(10) + 'RowId]' SET @Query = 'set nocount on; SELECT ROW_NUMBER() OVER (ORDER BY PDTMO.MONo DESC, PDTWF.CreateDate ASC) AS ' +…
Use of Unique Index in TSQL
In TSQL what is the significance of having Unique constraints with Not Enforced enabled? Even after creating this I am able to insert duplicates within the table…
Getting last modified SQL Database
Hi expert, we've already know how to get last modified data on specific table with SQL Trigger but how do we getting last modified Database either modified data(DML) or modified table\view (DDL) inside? does anyone have query for this? great thanks…
Microsoft SQL Server Studio - Dark Mode
Is there any official method to use Microsoft SQL Server Management Studio Studio with Dark Mode?
How to get a date of day in current week
Hi, I have table that stores configurations like In my sql code, I need to take currentDateTime and get current week date for Execution Day which is Wednesday. So, for this week, it will be 10-02-2024. Get following week wednesday date. Here it…
Pivot query result (column name will change)
Hi there, Have been working on a huge database task and one part of it is the below. How do i pivot this 1 row with dynamic columns (column names will change) Query: select top 1 * from INFORMATION_SCHEMA.columns Output should be ColumnName |…
How to fix Couldn't remove the user xx from database xx from the external libraries folder, error: 0x80070003
Hi Team, One of my client machine I can see lot of error message like " Couldn't remove the user XX from database XX from the external libraries folder, error: 0x80070003 Can you please suggest what is the issue and fix for it. SQL server 2019…
Excluding SLA CLock Time (Hold status) using PL/Sql Query and make MTTR
Hi, I have a query where I require to exclude "Hold Status" time b/w open to acknowledge status. So, support I have ticket '9607' and it is in the Open Status(INIT) and assigned. While selecting open to Hold and hold to open and then…
Getting the number of days before a status change
How do I get the number of days between 2 dates before a status change. There are times a status could flip back in the the future. Original table To the following
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…
Max value of each column in a table
Hi there, I have 500+ Azure SQL tables with total of 25000+ columns. Most of the tables have varchar (max), or nvarchar(max) but to contain a value which could only be 3 , 5 or 20 characters long. --for characters select max(**len(**columnname)) from…
better query for select results based on date.
What is the best way to write this code to get the date results? I have the time throughout the day in the datetime field. SELECT * FROM Reconciliation.Documents D Inner Join Reconciliation.DocumentsTransaction T ON D.DocumentPKey = T.DocumentPKey WHERE…
How to swap two rows in sql server
say ex: Id name 1 a 2 b 3 c 4 d 5 e 6 f i want output like: Id name 1 b 2 a 3 d 4 c 5 f 6 e Please help me how to write a SQL query
How to get a CSV file from a T-SQL in SQL Agent
I am using SQL agent to schedule a task. This task is the execution of a script that performs a query to several databases and concatenates the output. I have managed to obtain a file but not a CSV file, that is, I cannot obtain a file separating the…
Remove last 3 charecters in column
Hi, I need to remove three characters(.00) in below table result: 111111111 without (last three characters i.e .00) chr1111111111.0011111111.0011111111.001111111111.001111111.00111111.0011111111.001111.001111111.00
Update statement
How to convert query into update statement... Unable to do it select rt.outstandingamount,rt.outstandingamount * TT_USD.RateMultiplier,ENTITY,FromCurrencyKeyFK,ConversionCurrencyKey,RateMultiplier from deltalake.FactARReceiptDetail RT LEFT outer JOIN…
Like to review records incorrectly entered in the database
We have a database where we enter a record with a number with an alphanumeric suffix. But the software entered it incorrectly due to an algorithm issue which we are trying to fix now but past transactions need to be fixed in the database. If I know the…
date function in Sql
I have a timestamp where I want to query only based on the date and exclude time.