Skip to content
Advertisement

Tag: sql-server-2005

Select 2 columns in one and combine them

Is it possible to select 2 columns in just one and combine them? Example: select something + somethingElse as onlyOneColumn from someTable Answer Yes, just like you did: If you queried the database, you would have gotten the right answer. What happens is you ask for an expression. A very simple expression is just a column name, a more complicated

Is a Primary Key necessary in SQL Server?

This may be a pretty naive and stupid question, but I’m going to ask it anyway I have a table with several fields, none of which are unique, and a primary key, which obviously is. This table is accessed via the non-unique fields regularly, but no user SP or process access data via the primary key. Is the primary key

How to find Expr#### in Execution Plan

When looking at the actual execution plan for a query in SQL Server Management Studio (SSMS), how do I determine what an expression such as Expr1052 represents? When I identify the costly parts of the query and look at the properties of that operation, there are often references only to these Expressions, or scalar operators. I want to be able

How to return empty groups in SQL GROUP BY clause

I have a query to return how much is spent on-contract and off-contract at each location, that returns something like this: The problem is, I only get one row for locations that are all ad-hoc or all contracted expenses. I’d like to get two rows back for each location, like this: Is there any way I can accomplish this through

Advertisement