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…
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…
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…
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…