Skip to content
Advertisement

Tag: dynamic-sql

Dynamic SQL search improvement

I have this SQL query that I am using for dynamic search in the database: In the database I have e.g.: If I provide the input Microsoft Visio I would like it to list How can I improve my SQL query to achieve this? I have done googling, but haven’t found what I want to do exactly. Answer Either pass

Displaying multiple database tables in one table

I have multiple databases with the same table (an Eventlog with different values). The names of these databases are subject to change. I am trying to display the Eventlog tables in one consolidated table with the corresponding database name. I tried to using cursor and dynamic SQL statement to achieve this with no luck. As well, I’m not sure if

STUFF function truncated result

I am trying to generate dynamic sql by querying a table and using the STUFF function and returning the results into a variable (DECLARE @dynamic_query NVARCHAR(max)). My problem is that the results returned by the STUFF function are truncated/incomplete. The content of @dynamic_query will be cut short. I can’t find any references to character limits on the STUFF function online

How to Sort this MySQL Query

I am trying to insert the ORDER BY in this query to sort the Total column: With the following result: Here’s what I have tried so far but no luck: Answer I think you want: Rationale: the ORDER BY clause should go after all UNION ALL subqueries – so it needs to be outside of the GROUP_CONCAT(), in an outer

Advertisement