|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
The Hash Join I | |
What are the two inputs called to a hash join operation in SQL Server? (choose 2) | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (by Steve Jones - SSC Editor) |
Comparing Images I am building an ETL process between these tables in SQL Server 2022 set to 160 compatibility level: CREATE TABLE Image_Staging ( imageid INT NOT NULL CONSTRAINT Image_StagingPK PRIMARY KEY , imagestatus TINYINT , imagebinary IMAGE); GO CREATE TABLE Images ( imageid INT NOT NULL CONSTRAINT ImagesPK PRIMARY KEY , imagestatus TINYINT , imagemodified DATETIME , imagebinary IMAGE); GO I want to run this query to check if the images already loaded exist. This will help me decide if I need to insert or update an image. What happens with this query? SELECT i.imageid FROM dbo.Image_Staging AS ist INNER JOIN dbo.Images AS i ON ist.imagebinary = i.imagebinary; Answer: I get this error: Msg 402, Level 16, State 1, Line 19 Explanation: The ntext, text, and image datatypes cannot be used in direct joins. Ref: Joins - https://learn.microsoft.com/en-us/sql/relational-databases/performance/joins?view=sql-server-ver16 |
Featured Script |
Real-Time SQL Server to BigQuery Streaming ETL using CDC rahul.sarabu from SQLServerCentral CDC Changes: The script queries the CDC tables in SQL Server to retrieve the changes (inserts, updates, deletes) since the last sync. Each change is processed with a mapped operation type (INSERT, UPDATE, DELETE).
|
Database Pros Who Need Your Help |
Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2017 - Administration |
Manual Distribution Database Cleanup - Hi All. I have a reasonably straightforward transactional replication setup. I had two databases on Server a, that are replicated to server b for reporting purposes. All was going well until Halloween (yeah, I know) when one of the databases encountered file corruption. The database remained running but the backups failed, it truly was my […] |
SQL Server 2017 - Development |
Deduplicating rows by choosing the row with the shortest string - Hello T-SQL experts I have a table containing team codes and descriptions. Unfortunately, many of the team codes are duplicated, often with different descriptions. I want to deduplicate the table (in T-SQL) by selecting the shortest description (in number of characters) for each team code. How do I do this in a non-manual fashion? I […] |
SQL Server 2016 - Development and T-SQL |
query help - I need some help to optimize this query as it runs in many threads in an over night, and it pegs CPU. I can't change schema or field attributes as that is not in my control. The attvalue is a multipurpose field and believed to be some of my bottle neck. I have 32gig of […] |
SQL Server 2019 - Development |
Error converting data type varchar to numeric - issue resolved. |
Two queries or one? - The setup: 3 tables: core_users, core_roles, and core_user_roles. core users is the "base" table, core roles is a "look up" table, and core_user_roles contains 1-to-many foreign key references. To fix an oversight from when this was originally coded... the job spec says we need to insert any missing roles for a user if that user […] |
Best Clustered Index Configuration for Partitioned Multi-Tenant Table with RLS - I’m working with a SQL Server database that supports a multi-tenant application. We have row-level security based on a TENANTID column, which restricts data access by tenant. Here’s the setup: All tables include an identity column named ID that is currently the first key in the clustered index (defined as (ID, TENANTID)). The tables are […] |
Error loading multiple CSV files in SSIS - Hi everyone I have a bunch of CSV files that I need to bulk insert into a table. I saw this video on YouTube and implemented it. It works for some files but not for others. Basically, the approach from the video is to use a multi flat file connection manager to handle loading multiple […] |
Reporting Services |
Does SSRS Report with Stored Procedure execute SQL string? - I declare @Where based on the input parameter in the stored procedure. Set @SQL = 'Select * from Table1 ' + @where EXECUTE(@SQL) I created a dataset in SSRS to run the stored procedure. It returned no fields. Does SSRS Report with Stored Procedure execute SQL string? Thanks. |
Integration Services |
SSIS Package Consuming Excessive Disk Space on Local Drive (C:) - Hello everyone, I’ve developed an SSIS process to compare two relatively large tables. When I run the package from Visual Studio, the processing takes up space on my local PC's hard drive and continues until the drive is full (C:). Does anyone know why this Thanks in advance for your feedbac |
Building Pivot from SSIS with growing list of Month Columns - Good afternoon, I have an SSIS package which loads raw records into a sheet of an Excel file. I now need a second sheet with a Pivot (for these raw records) where the columns are of Months. But obviously with time, the list of months will continuously grow. My understanding is that for purposes of […] |
Unable to Pivot data in MS Excel for the (Output) file of SSIS package - Good Morning, I have built an SSIS package which produces Excel File Output. In the course of the Run, the package itself makes a copy of the Template Excel file before populating it with the new data. One of the fields is called 'Count' (it is actually stored as a Varchar in the SQL Table). […] |
SQL Server 2022 - Administration |
SQL Server Constrained Delegation - Hi, hoping someone can help. We're in the process of migrating to a new SQL instance and bulk load / insert from SMB share isn't working in SMSS or via SQL agent job I'm reasonably confident its Kerberos delegation as I see ANONYMOUS in the file server audit log with constrained delegation and when I […] |
Unencrypted connections in Always on Availability Group - Hi, In my Always On Availability environment, I am seeing two encrypt_option values as FALSE in the DMV sys.dm_exec_connections. This is causing issues in the database vulnerability scan. Please note that an SSL certificate is already applied, and the Force Encryption option is set to "Yes." How can I resolve this issue? |
SQL Server 2022 - Development |
Get Sum and Last month sum - I want to get the sum and I want to get the sum of only last month for VenNum by FiYr and DocDte. I am having trouble adding the sum of only the previous month. Select count(*) as cnt, T1.FiYr, T1.DocDte, T1.VenNum, Sum(T1.DocCurrAmt) as DocCurrAmt From WalgreensCnlySapPaidHistory.[dbo].[CnlySapRawPaidHistory] T1 Where DocTypeDesc Like '%Scan Base%' and T1.VenNum […] |
Closest to ProcDate - Not sure I have this 2nd left join correct. I need to grab the closest #Deptvalues.DeptDate and #Depvalues.Department within 1 day (before or after) of #ProcValues.ProcDate for each row. Each PatID and ProcDate combination in the #ProcValues table should look at the #Deptvalues table and create this connection. The desired outcome is enclosed. Appreciate any […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |