Azure – MERGE update with duplicates
I am trying to UPDATE target table but in source table I have duplicate data. I am trying in Azure SQL Server database. All will be ok with HASHBYTES but if I remove HASHBYTES it will raise an error: drop…
I am trying to UPDATE target table but in source table I have duplicate data. I am trying in Azure SQL Server database. All will be ok with HASHBYTES but if I remove HASHBYTES it will raise an error: drop…
I cannot connect to the database in the sql server in Azure. I cannot connect in any way, regardless of mssql server or visual studio on my own computer. I get my connection information from azure and try to login…
I have a query which first performs joins inside cte and then based on cte join with other table and perform group by with some aggregations and get the top 15 records. WITH join_table as ( SELECT pl.yearmonth, pl.pdid, pl.OrderId,…
I have 2 separate columns for the date: the date itself in YYYY-mm-dd format, and a time column in time(7) datatype, for example 11:15:10.0000000 How can I check for rows that are in the future? I can get the first…
I have designed a PurchaseOrder table - with partioning on CreatedDate column - In Visual Studion Data Tool as follow: CREATE TABLE [dbo].[PurchaseOrder] ( [IdGlobal] UNIQUEIDENTIFIER NOT NULL DEFAULT NEWID(), [IdLocal] BIGINT NOT NULL, [CreatedDate] DATE DEFAULT (getdate()) NOT NULL,…
I have an application running in a Docker container (Linux) and a SQL Server instance running on my local machine (in Windows). Despite providing the correct credentials in the connection string, I am unable to establish a connection from the…
I Want to select transactions under PL Category 52105 and transaction codes 9007 & 9803, but the results are are picking other transaction codes other than those 2. Where am I getting it wrong? FROM [Steward].[dbo].[vwNONFUNDED_RECOMP_04] WHERE PL_CATEGORY_CATEG_STMT IN ('52105')…
Suppose I have this SQL working: SELECT( SELECT a.id, a.label, a.text FROM [data] a FOR JSON PATH, INCLUDE_NULL_VALUES ) AS 'data' which will produce JSON with this structure: [ { "id": "N/A", "label": "test", "text": "Not applicable" }, { "id":…
I'm trying to rewrite two pieces of SQL Server code to PostgreSQL. The 1st one is: WHERE (DATEADD(S, Submit_Date, '1970-01-01')) >= DATEADD(d, -3, GETDATE()) OR (DATEADD(S, Last_Changed_Date, '1970-01-01')) >= DATEADD(d, -3, GETDATE()) I keep getting an error regarding the S…
I have the two tables assets and transactions in my database, whereby transactions are connected to assets by the columns transactions.from_id and transactions.to_id: assets: id title 1 a1 2 a2 3 a3 transactions: id title from_id to_id 1 t1 1…