All Questions

269
votes
16answers
357151 views

How to use GROUP BY to concatenate strings in SQL Server?

How do I get: id Name Value 1 A 4 1 B 8 2 C 9 to id Column 1 A:4, B:8 2 C:9
68
votes
7answers
86726 views

Why do we always prefer using parameters in SQL statements?

I am very new to working with databases. Now I can write SELECT, UPDATE, DELETE, and INSERT commands. But I have seen many forums where we prefer to write: SELECT empSalary from employee where salary...
269
votes
6answers
306716 views

How do I obtain a Query Execution Plan?

In Microsoft SQL Server how can I get a query execution plan for a query / stored procedure?
142
votes
10answers
264231 views

Turning a Comma Separated string into individual rows

I have a SQL Table like this: | SomeID | OtherID | Data +----------------+-------------+------------------- | abcdef-..... | cdef123-... | 18,20,22 | abcdef-..... | 4554a24-... | 17,1...
573
votes
10answers
279374 views

Count(*) vs Count(1)

Just wondering if any of you guys use Count(1) over Count(*) and if there is a noticeable difference in performance or if this is just a legacy habit that has been brought forward from days gone past?...
176
votes
4answers
44739 views

What makes a SQL statement sargable?

By definition (at least from what I've seen) sargable means that a query is capable of having the query engine optimize the execution plan that the query uses. I've tried looking up the answers, but ...
181
votes
6answers
496790 views

Convert Rows to columns using 'Pivot' in SQL Server

Well I guess I am really dense. I have read the stuff on MS pivot tables and I am still having problems getting this correct. I have seen some of you that seem to eat and sleep this stuff, so I just d...
132
votes
11answers
157816 views

T-SQL: Opposite to string concatenation - how to split string into multiple records

Possible Duplicate: Split string in SQL I have seen a couple of questions related to string concatenation in SQL. I wonder how would you approach the opposite problem: splitting coma delimi...
228
votes
31answers
955964 views

Why am I getting "Cannot Connect to Server - A network-related or instance-specific error"?

I get the following error when trying to connect to SQL Server: Cannot connect to 108.163.224.173. A network-related or instance-specific error occurred while establishing a connection to ...
77
votes
30answers
601021 views

How to split a comma-separated value to columns

I have a table like this Value String ------------------- 1 Cleo, Smith I want to separate the comma delimited string into two columns Value Name Surname ------------------- 1 Cleo ...

Previous Next