Skip to content
Advertisement

Tag: tsql

Cloning tree structure with guid

I am trying to clone tree structure to another table, but the problem is original table has guid as ParentId and Id and new table or table that I want to clone has int as ParentId and Id. I am trying …

SQL for storing numbers from cold to hot for specific range?

We have a table that looks list this: date, val1, val2, val3, val4, val5 for a given row, val1 -val5 are unique and between 1 and 37 Using T-SQL, How can I list numbers 1 -37 by cold to hot with their frequency for a given date range? [![enter image description here][1]][1] Sample Output (NOT ACTUAL): Numbers by frequency descending:

Eror While Executing a dynamic queries in a variable

I’m executing a dynamic query from a variable but it always says: Could not find stored procedure I have tried to use simpler queries like set @query = ‘select * from [table_name]’ but it gives the same error. In my temporary table is the list of all my trigger name so the expected output I want to get is Command(s)

Query SQL with similar values

I have to make a query to a base using as a comparison a string like this 12345678, but the value to compare is this way12.345.678, if I do the following query it does not return anything. SELECT * …

How can I solve a performance issue in my stored procedure?

I have a performance problem with a stored procedure. Because when I check my benchmark’s result I realized that “MatchxxxReferencesByIds” has ‘240.25’ ms Average LastElapsedTimeInSecond. How can I improve my procedure? Answer Based on the execution plan of the stored procedure, what makes it to perform slowly, is the part where you are going to work with XML. Lets rethink

Getting the personal contact details of an employee

I want to get the Email, Phone and Mobile number of each employee. The ContactDetailsType contains the Label which is email,phone,fax… and ContactDetails contains the ContactDetailsTypeId (the ID of ContactDetailsType) and the Info having the value of the phone number (for example). I tried the following query to get the phone but I’m getting the following error : Subquery returned

Advertisement