How to get an actual execution plan from the linked server?

There is a “main” SQL Server to which I have full access and I can connect to it via SSMS. Its version is:

Microsoft SQL Server 2016 (SP1-CU15-GDR) (KB4505221) - 13.0.4604.0 (X64) 
    Jun 15 2019 07:56:34 
    Copyright (c) Microsoft Corporation
    Enterprise Edition: Core-based Licensing (64-bit) on Windows Server 2016 Datacenter 10.0 <X64> (Build 14393: ) (Hypervisor)

There is a linked server defined on the main server. The linked server is:

Microsoft SQL Azure (RTM) - 12.0.2000.8 
    Feb 20 2021 17:51:58 
    Copyright (C) 2019 Microsoft Corporation

I can’t connect directly to that remote server via SSMS, but I can run all sorts of queries against it using OpenQuery. For example, I got its version by running this:

select * from OpenQuery((LinkedServerName), 'select @@version');

There are a number of complex legacy queries that are run on the remote linked server via OpenQuery.

I wanted to analyze them and see if there are any obvious/easy ways to improve their performance. To do that I wanted to get their execution plans. If I try to get an execution plan on a local server all I get is one Remote Scan operator that takes 35 minutes without any details.

I know that there is a SET STATISTICS XML ON statement that returns an execution plan of a query.
Unfortunately, when I tried to put it into the OpenQuery, it didn’t work.

Let me explain.

I can run the actual query:

select * from OpenQuery((LinkedServerName), 
'
--SET STATISTICS XML ON;
select TOP(10) * from bms.digitalbookinglinezone;
--SET STATISTICS XML OFF;
');

This returns me 10 rows as expected. When I uncomment the SET STATISTICS XML lines I get the following error message:

Msg 11527, Level 16, State 1, Procedure
sys.sp_describe_first_result_set, Line 1 (Batch Start Line 0) The
metadata could not be determined because statement ‘SET STATISTICS XML
ON;’ does not support metadata discovery.

At the same time I can run the following query just fine:

select * from OpenQuery((LinkedServerName), 
'
SELECT * FROM sys.dm_exec_describe_first_result_set
(N''select TOP(10) * from bms.digitalbookinglinezone'', null, 1);
')

And I’m getting valuable information about all columns in the remote table.

Is there any other “T-SQL” way of getting the execution plans?
Something that I could use via the OpenQuery?

data leakage – Over 533 millions Facebook s linked phone numbers leaked with 1 user out of 2 affected in my country. How to find out if I m affected?

The following kind of article about a data leak becoming free https://www.bleepingcomputer.com/news/security/533-million-facebook-users-phone-numbers-leaked-on-hacker-forum/ is making the headlines.

The problem is such data don t contains email addresses and isn t about account access theft. So it s not in projects like amIpwned.

So I tried to search about where that list is published in order to download it and look at the single entry I m interested in but found only other news articles on the topic.

How to check if my account along my phone number is in that list?

C++ Program which seperates the nodes in the linked list in such a way that all the even nodes appear at the begining of the Linked List

Can anyone exaplain me this code.this runs perfectly but i cant understand how :(. i’ve approached this by creating a structure for the nodes of teh linked list. And then two functions , one for insetion at the beginniing of teh linked list and one to display the linked list.

Can one please explain the void seggregate function

#include <bits/stdc++.h>

using namespace std;

struct LLNode
{
    int data;
    struct LLNode* next;
};


void insertAtBeginning(struct LLNode** head, int dataToBeInserted)
{
    struct LLNode* current = new LLNode;
    current->data = dataToBeInserted;
    current->next = NULL;    
    if(*head == NULL)
            *head=current; 
        
    else
        {
            current->next=*head; 
            *head=current;
        }
        
}



void display(struct LLNode**node)
{
    struct LLNode *temp= *node;
    while(temp!=NULL)
        {
            if(temp->next!=NULL)
            cout<<temp->data<<" --> ";
            else
            cout<<temp->data;
            
            temp=temp->next; 
        }

    cout<<endl;
}



void Segregate(struct LLNode **head)
{
    struct LLNode *end = *head;
    struct LLNode *previous = NULL;
    struct LLNode *current = *head;
    while (end->next != NULL)
    {
        end = end->next;
    }
    struct LLNode *new_end = end;
    while(current->data % 2 != 0 && current != end)
    {
        new_end->next = current;
        current = current->next;
        new_end->next->next = NULL;
        new_end = new_end->next;
    }
 
    if(current->data%2 == 0)
    {
        *head = current;
        while(current!= end)
        {
            if((current->data)%2 == 0)
            {
                previous = current;
                current = current->next;
            }
            else
            {
                previous->next = current->next;
                current->next = NULL;
                new_end->next = current;
                new_end = current;
                current = previous->next;
            }
        }
    }
    else previous = current;
    if (new_end!=end && (end->data)%2 != 0)
    {
        previous->next = end->next;
        end->next = NULL;
        new_end->next = end;
    }
    return;
}

int main()
{
    struct LLNode* head = NULL;
    insertAtBeginning(&head, 341);
    insertAtBeginning(&head, 362);
    insertAtBeginning(&head, 921);
    insertAtBeginning(&head, 748);
    insertAtBeginning(&head, 210);
    insertAtBeginning(&head, 701);
    insertAtBeginning(&head, 300);
    insertAtBeginning(&head, 899);
    insertAtBeginning(&head, 407);
    insertAtBeginning(&head, 666);
    insertAtBeginning(&head, 369);
    insertAtBeginning(&head, 235);
    insertAtBeginning(&head, 236);

   
    cout<<endl;
    cout<<endl;
    cout<<"The Input linked list is:    "<<endl;
    
    display(&head);
 
    Segregate(&head);
    
    cout<<endl;
    cout<<endl;
    cout<<"The Final Modified linked list in such a way that all the even nodes appear at the begining of the Linked List is:   "<<endl;
    
    display(&head);
    
    cout<<endl;
    cout<<endl;
 
    return 0;
}

Providers in SQL Server linked server configuration

How ‘allow in process’ works for providers in SQL server linked server configuration ? It looks like it’s unchecked by default. What is the requirement for keeping this option checked and What are the pros and cons of using it.

Is there a way to add a linked slide within the same Google Slide presentation?

I’m familiar with the linked slides feature in Google Slides to insert a linked slide from another presentation. This allows edits in the source slide to flow through to the linked slides in the other presentations.

Is there a way to do this when pasting the slide into the original presentation (i.e. at a different section of the same pack)?

sharepoint online – Linked lists – new record and edit record display of linked data

So this is likely one of those ‘any fule knows how to do that’ type questions, or one of those ‘any fule knows you can’t do that’ type. Still, as the fule in question, guilty as charged (blush).
So let us say I have two lists, or rather, a list and a document library. The linkage allows multiple documents to be associated with a single line entry of Work_ID data:

DOCUMENT LIBRARY:
Document_Name, Document_Owner, Document_Contact, Work_ID – linked list field, displays LIST:Description, LIST:Work_Lead, LIST:Work_Contact

LIST:
Work_ID, Description, Work_Lead, Work_Contact

So far, all is well – at least for display purposes. The DOCUMENT record displays, along with related WORK_ID data. But when creating a new DOCUMENT entry, the Work_ID is a drop-down with, let’s say, 200 potentially anonymous numbers in. Unless the person already knows the Work_ID to use, they would have to go away and find it. So what I’d like is for the drop down for Work_ID to also display the linked LIST:Description (and potentially other) fields in the (New Document metadata creation) screen that comes immediately after upload and when a DOCUMENT record is being edited. Of course, as the fule indicated above and a relative novice I have no idea if this can be done and if so how :-). Might anyone have any guidance/ comment?

SQL Server 2019 using Linked server to Oracle 19c (19.9) using Oracle 19c client on Windows – DBCOLUMNFLAGS_ISNULLABLE error

Having issues selected data for some Oracle tables over the linked server from SQL Server:

select type, count(*) from RMTDB..JOB1308.HOST_INTERFACE group by type order by 1 desc;

Msg 7356, Level 16, State 1, Line 13
The OLE DB provider “OraOLEDB.Oracle” for linked server “RMTDB” supplied inconsistent metadata for a column. The column “CREATE_TIME” (compile-time ordinal 3) of object “”JOB1308″.”HOST_INTERFACE”” was reported to have a “DBCOLUMNFLAGS_ISNULLABLE” of 0 at compile time and 32 at run time.

Open query version of it works:

select * from OPENQUERY( RMTDB, 'select type, count(*) from HOST_INTERFACE group by type order by 1 desc')

result

TYPE      COUNT(*)
10          10450
8            6543
6            21

Anyone run into this?

java – Reverse linked list(using Recursion) – Time and space Complexity

How to calculate time and space complexity for the below recursive code.

Idea : Initially traverse till previous of last node and make the last node to point it’s previous node and the previous node to point null. (Do the same until head point’s to null)

private void reverseList(Node node,Node prev) {
    
    if (node.next == null) {
        node.next = prev;
        prev.next = null;
    }
    else {
        reverseList(node.next,node);
        if(node != head) {
            reverseList(node,prev);
        }
    }   
}
//method calling
reverseList(head.next,head);//head points to start node

How to calculate time complexity using tree method or substitution method? How to derive equation for this code? Also would like to get suggestion on code optimization and better approach.

Thanks in Advance!!

github – Please help! Why am I getting a segmentation fault for alphabetical linked list when inserting at the end of the list?

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

struct node
{
char name(35);
int venue(500);
struct node *next;
};

struct node *head = NULL; // global pointer head variable

int main()
{
int option;
int cont = 1; // flag variable used in the infinate while loop so the program keeps running until exit(1)

while (cont == 1)
{

printf("********* COVID Tracing App Using Dynamic Memory *********nn");

printf("1. Introduce new usern");
printf("2. Introduce visit to venuen");
printf("3. Remove usern");
printf("4. Check which users have been in a particular placen");
printf("5. Save to filen");
printf("6. Retrieve data from filen");
printf("7. Exitn");
printf("8. Print all records (extra)n");

scanf("%d", &option);

switch (option)
{
    case(1):
    {
        printf("n******Introduce new user******nn");
        
        // we first need to check the user hasn't already been entered
        
        char newUser(35);
        
        printf("Please enter the name of the person you would like to add to the database ");
        scanf("%s", newUser);
        
        
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        
        // scan through entire linked list to ensure the user hasn't already appeared
        
        struct node *temp;
    
        temp = head;    // done to ensure 'head' is not changed
    
        int j = 0;      // flag variable remains 0 if no match is found
    
        while(temp != 0)
        {
            if (strcmp(temp->name,newUser) == 0)
            {
                j = 1;
                
                printf("nI'm sorry, but it appears the user '%s' has already been entered!nn", temp->name);
                
                break;
                
            }
        
            temp = temp->next;  // iterate from the newst entry to the oldest entry
        }
        
        if (j == 1)     // if there was a match, the program will return to main menu
        {
            break;
        }
        
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        
        /* Now that we know the user has not been previously entered, we can
         * proceed to create a new record */
        
        /* As we are dealing with dynamic memory, we firstly need to create a pointer
         * variable that can point to a new structure on the heap */
        
        /* If however, this is the first entry, we need to create a structure on the
         * heap that the first pointer 'head' will point to, then fill it with the
         * data. 'head' will now NOT be pointing to zero - it will be pointing to
         * the location of the dynamically allocated memory on the heap. We now need to
         * point the 'next pointer' to the NULL position to indicate the last
         * structure on the list. */
         
        if (head == 0)
        {
            head = (struct node*)malloc(sizeof(struct node));
            
            int a;

            for (a = 0; a < 500; ++a)       
            {
                head->venue(a) = 0;
            }
            
            strcpy(head->name, newUser);
            head->next = NULL;
        }
        
        else    // if not the first entry
        
        {
            struct node *new_node;      //creating new node pointer
        
            /* We now need to allocate enough memory on the heap for this new record */
        
            new_node = (struct node*)malloc(sizeof(struct node));   // allocating heap memory to that pointer
            
        
            /* We have now allocated the required amount of heap memory for the new record
            * and we have pointed the structure pointer variable to it. We can now fill it
            * with the name of the person AND initialize the location array to zero (as
            * they so far haven't entered any information on where they have been */
        

            strcpy(new_node->name, newUser);                // fills the name data in the new heap record (node)

            int a;

            for (a = 0; a < 500; ++a)       /* This for loop will ensure that when a new user is
                                            created, all venue locations are set to zero. This is
                                            * also known as 'initiallizing the venue array' associated
                                            * with the new user.*/
            {
                new_node->venue(a) = 0;
            }
            
            //  *****************ALPHEBETICAL INSERTION *****************************
            
            struct node *curr;
            struct node *trail;
            
            
            
            curr = head;
            trail = NULL;
            
            while (strcmp(curr->name, new_node->name) < 0 )
            {
                trail  = curr;
                curr = curr->next;
                
            }
            
            // if head insertion
            
            if (curr == head)
            {
                head = new_node;
                new_node->next = curr;
            }
            
            // if mid insertion
            
            else if ((curr != 0) && (curr != head) )
            {
                new_node->next = curr;
                trail->next = new_node;
            }
            
            // if tail insertion
            
            
            
         **else if (curr == NULL)     **//THIS IS WHERE THE PROBLEM IS**
            {
                trail->next = new_node;
                new_node->next = NULL;
            }**
                
            
        }

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        break;
    }
    
    case(2):
    {
        printf("nCase 2 goes herenn");
        break;
    }
    
    case(3):
    {
        printf("nCase 3 goes herenn");
        break;
    }
    case(4):
    {
        printf("nCase 4 goes herenn");
        break;
    }
    case(5):
    {
        printf("nCase 5 goes herenn");
        break;
    }
    case(6):
    {
        printf("nCase 6 goes herenn");
        break;
    }
    case(7):
    {
        printf("nExitnn");
        break;
    }
    case(8):
    {
        printf("n******(Extra) Print All Records******nn");
        
        struct node *temp;
    
        temp = head;
    
        int k = 0;      // flag variable used to keep track of the number of entires
    
        while(temp != 0)
        {
            printf("***Record No.%d***n", k+1);
            printf("Name: %sn", temp->name);
        
            temp = temp->next;
            ++k;
        }
        
        break;
    }
}

}

return 0;

}

Linked Server connection started failing with “Cannot generate SSPI context … SQL Server Network Interfaces: The logon attempt failed” error?

I have two SQL Server 2016 Standard Edition servers on the same domain. Server A has two linked server connections setup to Server B.

The first linked server connection is using a dedicated remote SQL Login security context. That one always was and still is working fine.

The second connection uses the “login’s current security context” which is a Windows Authentication (AD) Login on Server A. This was also working fine up until today.

Today out of nowhere, everyone who connects to Server A and then tries to run a query that uses the second linked server connection, ends up getting hit with this error:

OLE DB provider “SQLNCLI11” for linked server “APIVIEWPOINTSERVER”
returned message “Cannot generate SSPI context”. Msg -2146893044,
Level 16, State 1, Line 0 SQL Server Network Interfaces: The logon
attempt failed

The only other potentially relevant thing I’m aware of, is a lot of users AD passwords are due to expire this week (due to our security policy). Supposedly some of them have already changed their AD passwords and are still hitting the above error, but I’m not sure how reliable that information is (can’t always trust the end users :).