tsql sum amount recursively without recursive cte
Hi, I need help creating recursive query to sum up Amounts of all ChildIDs for parent ID=1 node. Table definition and data below. This is for SQL serverless where Recursive CTE is not supported. So left join would do, The table is large and the query…
SQL Server Login with view to only one database
Hi I have a request to create a SQL account on my Instance of SQL 2014 I want the user to connect to instance - Done And have read write access to only 1 schema - Done view only 1 database - Not working out How i can i restrict user to see only 1…
Using Temporary Tables and Re-Using Temporary Tables in a SSRS Report
So we need to standardize Member Eligibility by using a SQL Server Stored Procedure that will be called, Executed by our Patient/Member SSRS Reports. The SQL Server Stored Procedure currently uses a Global Temporary Table to pass its result set back to…
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
How to covert UTC time to CST
I have a dataset recorded in UTC format. I want to covert it and add a field as CST. I used convert(datetime, switchoffset(convert(datetimeoffset, @UTCTime), datename(TzOffset, sysdatetimeoffset()))) to covert CST. However, I found it changed the time…
Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Hi Team, We are getting below error while running query in SSMS: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. Normally it shouldm't take more than 2 mins. But from…
Unable to install sql server 2022 express on my Personal laptop. Could you please help with it? Iam struggling here. Any amount of help is appreciated
The following is the message i see in my log file Overall summary: Final result: Failed: see details below Exit code (Decimal): -2147467259 Start time: 2024-10-31 14:13:52 End time: …
msdb.dbo.sp_send_dbmail running in SQL Agent
Hello I have a SSIS package that all runs fine in Visual Studio, but fails when it runs in SQL Agent, most of the Tasks work and 95% of the time the package completes successfully, it just when it hits my Execute SQL task that has msdb.dbo.sp_send_dbmail…
SQL Server 2022 RTM-CU13 KB5036432 sql replication do not work on availability database of always on availability group
Hi Sir/Madam, My name is Bao Viet from Vietnam. Current im involving in a project and in that project we decide to use SQL Replication to synchronize a table to a remote SQL Server. On customer site, i have a cluster with 2 node, which were setup as…
How detecting the field that causes "string or binary data would be truncated" error
Hi, I'm working on a SQL Server 2017 (RTM-CU31-GDR) instance and I'm testing an INSERT INTO ... SELECT ... FROM ... statement that unfortunately causes a "string or binary data would be truncated" error. If possible, I'd like to save…
Collation issue when using merge
Trying to load data from TableA (Source) to TableB (Target) by Merge query. One of the columns in TableA is Latin1_General_CS_AS, while the target column in TableB is Latin1_General_CI_AS. Should I firstly change collation setting in Table B before…
Select top 1 field with same table
I have written this query but its executing very slow, We have 8000 of rows and this query takes almost 10 mins to execute. If anyone can help with this query optimization will be grateful. SELECT v.iID_Event_People, CASE WHEN…
tune query in sql
Hi, How to tune below query in sql,if it has 1 billion records Select A.*,B.* from INTO TEMP TableA inner join TableB ON TableA.PersonID=TableB.PersonaID where TableA.PersonCity In ('A','B','C') and TableB.personCity in ('A','B','C'))
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…
How to convert decimal into words
I want to convert amount which is in decimal to words. please help
How can I make my json sql query dynamic
Hello team of experts, I have a field named MEASUREMENT_DATA_CONFIG in one of my tables named PROCESS_T that contains json code in my ms sql database catalog. Unfortunately I am not able to read the data dynamically in a clean way. If I specify the…
Microsoft SQL Server Studio - Dark Mode
Is there any official method to use Microsoft SQL Server Management Studio Studio with Dark Mode?
Correct SQL query to not repit articles
Hello, good afternoon, I have the following query in SQL and it is returning duplicate items. I managed to decipher that the items that are duplicated in the "On Orders" column in one row appear with one quantity and in the next row (Same item,…
CURSOR for column in WHERE that gives dynamic columns in SELECT
Hello, I need help to make my query more simple Depends how many rows for column Code (now I have 53 rows) then it will be 53 sub selects and 53 more columns. How to make it simple to add variable in select and in sub select instead of writing 53 times…
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…