Skip to content
Advertisement

Tag: sql-server

Replace OUTER APPLY

I want to replace some OUTER APPLYs in my SQL because they seem to be a little bit slow and eating resources () on a poor VPS. I have no idea what to use instead? LEFT OUTER JOIN (??) Here’s my code The query processor ran out of internal resources and could not produce a query plan. This is a

How to create a trigger for this situation?

I have a problem inserting values into a Class table. I want to write a trigger to prevent happening “an instructor teaches in different class_Id at the same time”. How can I do this? This is the trigger which I’ve created: Answer Use inserted and JOIN to the Class table. Check for existence of rows in table that matches your

Calculation using SQL server

Formula used This is the formula that I used to calculate Expressed as a single equation: Code that I tried Correct answer should be 123. Any clue what I am missing in the query? Answer According to this site your equation is kinda wrong. Please be sure to add ^ to display the “to the power of”. Also this result

Table recursive lookup on itself

I have the following table below. I want to select all of the members of Group-D However, Group-D also contains Group-C along with User 5. Group-C contains Group-A and Group-B. So, the select should return: Obviously, without doing multiple lookups on itself, I will not get that output. How can I make the select statement do a table lookup within

Advertisement